diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-09 17:34:10 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-09 17:34:10 +0000 |
commit | 0265b721e9468ea54315b4c759ed894057d6c6d4 (patch) | |
tree | 3d255b674b1d9f300d842c3696c2bef6cd9f7869 /libjava/java/nio/channels/spi/AbstractSelector.java | |
parent | 6e82c5c2ec51f97ebf3f43529499a0c312b23f6f (diff) | |
download | ppe42-gcc-0265b721e9468ea54315b4c759ed894057d6c6d4.tar.gz ppe42-gcc-0265b721e9468ea54315b4c759ed894057d6c6d4.zip |
2003-10-09 Michael Koch <konqueror@gmx.de>
* java/nio/channels/spi/AbstractSelectableChannel.java
(registered): Made private.
(blocking): Likewise.
(LOCK): Likewise.
(provider): Likewise.
(keys): Made it a private LinkedList.
(AbstractSelectableChannel): Initialize keys.
(isRegistered): New implementation.
(locate): Rewritten.
(register): Rewritten.
* java/nio/channels/spi/AbstractSelectionKey.java
(ok): Removed.
(cancelled): New member variable.
(cancel): Rewritten.
(isValid): Rewritten.
* java/nio/channels/spi/AbstractSelector.java:
Some methods moved.
(closed): Make private.
(provider): Likewise.
(cancelledKeys): New member variable.
(AbstractSelector): Initialize cancelledKeys.
(cancelKey): New method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72275 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/nio/channels/spi/AbstractSelector.java')
-rw-r--r-- | libjava/java/nio/channels/spi/AbstractSelector.java | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/libjava/java/nio/channels/spi/AbstractSelector.java b/libjava/java/nio/channels/spi/AbstractSelector.java index 160cdc00365..58ce0c84f60 100644 --- a/libjava/java/nio/channels/spi/AbstractSelector.java +++ b/libjava/java/nio/channels/spi/AbstractSelector.java @@ -1,5 +1,5 @@ /* AbstractSelector.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,11 +42,13 @@ import java.io.IOException; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.util.Set; +import java.util.HashSet; public abstract class AbstractSelector extends Selector { - boolean closed = false; - SelectorProvider provider; + private boolean closed = false; + private SelectorProvider provider; + private HashSet cancelledKeys; /** * Initializes the slector. @@ -54,16 +56,10 @@ public abstract class AbstractSelector extends Selector protected AbstractSelector (SelectorProvider provider) { this.provider = provider; + this.cancelledKeys = new HashSet(); } /** - * Marks the beginning of an I/O operation that might block indefinitely. - */ - protected final void begin () - { - } - - /** * Closes the channel. * * @exception IOException If an error occurs @@ -73,8 +69,8 @@ public abstract class AbstractSelector extends Selector if (closed) return; + implCloseSelector(); closed = true; - implCloseSelector (); } /** @@ -85,11 +81,16 @@ public abstract class AbstractSelector extends Selector return ! closed; } - protected final void deregister (AbstractSelectionKey key) + /** + * Marks the beginning of an I/O operation that might block indefinitely. + */ + protected final void begin() { - cancelledKeys ().remove (key); } - + + /** + * Marks the end of an I/O operation that might block indefinitely. + */ protected final void end() { } @@ -101,7 +102,12 @@ public abstract class AbstractSelector extends Selector protected final Set cancelledKeys() { - return null; + return cancelledKeys; + } + + final void cancelKey (AbstractSelectionKey key) + { + cancelledKeys.remove (key); } /** @@ -111,4 +117,9 @@ public abstract class AbstractSelector extends Selector protected abstract SelectionKey register (AbstractSelectableChannel ch, int ops, Object att); + + protected final void deregister (AbstractSelectionKey key) + { + // FIXME + } } |