170 |
protected SelectionKey register (AbstractSelectableChannel ch, int ops, |
protected SelectionKey register (AbstractSelectableChannel ch, int ops, |
171 |
Object att) |
Object att) |
172 |
{ |
{ |
173 |
/* |
SelectionKeyImpl result; |
174 |
// filechannel is not selectable ? |
|
|
if (ch instanceof FileChannelImpl) |
|
|
{ |
|
|
FileChannelImpl fc = (FileChannelImpl) ch; |
|
|
SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, fc.fd); |
|
|
keys.add (impl); |
|
|
return impl; |
|
|
} |
|
|
else |
|
|
*/ |
|
|
|
|
175 |
if (ch instanceof SocketChannelImpl) |
if (ch instanceof SocketChannelImpl) |
176 |
{ |
{ |
177 |
SocketChannelImpl sc = (SocketChannelImpl) ch; |
SocketChannelImpl sc = (SocketChannelImpl) ch; |
178 |
SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd); |
result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument |
179 |
add (impl); |
} |
180 |
return impl; |
else if (ch instanceof DatagramChannelImpl) |
181 |
} |
{ |
182 |
|
DatagramChannelImpl dc = (DatagramChannelImpl) ch; |
183 |
|
result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument |
184 |
|
} |
185 |
else if (ch instanceof ServerSocketChannelImpl) |
else if (ch instanceof ServerSocketChannelImpl) |
186 |
{ |
{ |
187 |
ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch; |
ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch; |
188 |
SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd); |
result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument |
|
add (impl); |
|
|
return impl; |
|
189 |
} |
} |
190 |
else |
else |
191 |
{ |
{ |
192 |
System.err.println ("INTERNAL ERROR, no known channel type"); |
throw new InternalError ("No known channel type"); |
193 |
} |
} |
194 |
|
|
195 |
return null; |
add (result); |
196 |
|
result.interestOps (ops); |
197 |
|
result.attach (att); |
198 |
|
return result; |
199 |
} |
} |
200 |
} |
} |