summaryrefslogtreecommitdiff
path: root/gnu/java/nio/SelectorImpl.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-06-18 09:45:00 +0000
committerMichael Koch <konqueror@gmx.de>2003-06-18 09:45:00 +0000
commitf80652ec3090e09e9cb8796b34f2f4ae9a5998e4 (patch)
treeb8b1162794842b61e55bb8134f03d24a2a597142 /gnu/java/nio/SelectorImpl.java
parent6c409b7b81c880372be52766ac4243757f669695 (diff)
downloadclasspath-f80652ec3090e09e9cb8796b34f2f4ae9a5998e4.tar.gz
2003-06-18 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileChannelImpl.java, gnu/java/nio/SelectorImpl.java, gnu/java/nio/ServerSocketChannelImpl.java, gnu/java/nio/SocketChannelImpl.java, java/nio/DirectByteBufferImpl.java: New versions from libgcj.
Diffstat (limited to 'gnu/java/nio/SelectorImpl.java')
-rw-r--r--gnu/java/nio/SelectorImpl.java42
1 files changed, 18 insertions, 24 deletions
diff --git a/gnu/java/nio/SelectorImpl.java b/gnu/java/nio/SelectorImpl.java
index 14cfe9a19..494d5c309 100644
--- a/gnu/java/nio/SelectorImpl.java
+++ b/gnu/java/nio/SelectorImpl.java
@@ -170,37 +170,31 @@ public class SelectorImpl extends AbstractSelector
protected SelectionKey register (AbstractSelectableChannel ch, int ops,
Object att)
{
- /*
- // 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
- */
-
+ SelectionKeyImpl result;
+
if (ch instanceof SocketChannelImpl)
- {
+ {
SocketChannelImpl sc = (SocketChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd);
- add (impl);
- return impl;
- }
+ result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument
+ }
+ else if (ch instanceof DatagramChannelImpl)
+ {
+ DatagramChannelImpl dc = (DatagramChannelImpl) ch;
+ result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument
+ }
else if (ch instanceof ServerSocketChannelImpl)
{
ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd);
- add (impl);
- return impl;
+ result = new SelectionKeyImpl (ch, this, 0); // FIXME: last argument
}
else
- {
- System.err.println ("INTERNAL ERROR, no known channel type");
- }
+ {
+ throw new InternalError ("No known channel type");
+ }
- return null;
+ add (result);
+ result.interestOps (ops);
+ result.attach (att);
+ return result;
}
}