aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/java/nio/SelectorImpl.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-06-14 11:53:02 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-06-14 11:53:02 +0000
commit81d2d258f5b5578131c9add593df10bd4758f219 (patch)
treeb079e077f62874b5e1b42c98455301dc0d73a902 /libjava/gnu/java/nio/SelectorImpl.java
parent34e8290f9591d58d0e3d78dfe09a1ea5973cf06a (diff)
downloadgcc-81d2d258f5b5578131c9add593df10bd4758f219.zip
gcc-81d2d258f5b5578131c9add593df10bd4758f219.tar.gz
gcc-81d2d258f5b5578131c9add593df10bd4758f219.tar.bz2
2003-06-14 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileChannelImpl.java (map_address): Removed incorrect comment. * gnu/java/nio/SelectorImpl.java (register): Remove code duplication and code for file channel handling. * gnu/java/nio/ServerSocketChannelImpl.java (serverSocket): Renamed from sock_object. (ServerSocketChannel): Initialize serverSocket. (socket): Return serverSocket. * gnu/java/nio/SocketChannelImpl.java (socket): Renamed from sock_object. (isConnectionPenging): Simplified. (socket): Return socket. From-SVN: r67940
Diffstat (limited to 'libjava/gnu/java/nio/SelectorImpl.java')
-rw-r--r--libjava/gnu/java/nio/SelectorImpl.java39
1 files changed, 10 insertions, 29 deletions
diff --git a/libjava/gnu/java/nio/SelectorImpl.java b/libjava/gnu/java/nio/SelectorImpl.java
index e3eed25..f2281a6 100644
--- a/libjava/gnu/java/nio/SelectorImpl.java
+++ b/libjava/gnu/java/nio/SelectorImpl.java
@@ -250,50 +250,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);
-// impl.interestOps (ops);
-// impl.attach (att);
-// return impl;
-// }
-// else
-
+ SelectionKeyImpl result;
+
if (ch instanceof SocketChannelImpl)
{
SocketChannelImpl sc = (SocketChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd);
- add (impl);
- impl.interestOps (ops);
- impl.attach (att);
- return impl;
+ result = new SelectionKeyImpl (ch, this, sc.fd);
}
else if (ch instanceof DatagramChannelImpl)
{
DatagramChannelImpl dc = (DatagramChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, dc.fd);
- add (impl);
- impl.interestOps (ops);
- impl.attach (att);
- return impl;
+ result = new SelectionKeyImpl (ch, this, dc.fd);
}
else if (ch instanceof ServerSocketChannelImpl)
{
ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch;
- SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd);
- add (impl);
- impl.interestOps (ops);
- impl.attach (att);
- return impl;
+ result = new SelectionKeyImpl (ch, this, ssc.fd);
}
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;
}
}