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. From-SVN: r72275
This commit is contained in:
parent
93d046861d
commit
4e3cb200a5
4 changed files with 81 additions and 49 deletions
|
@ -1,5 +1,5 @@
|
|||
/* AbstractSelectionKey.java --
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -45,7 +45,7 @@ import java.nio.channels.SelectionKey;
|
|||
public abstract class AbstractSelectionKey
|
||||
extends SelectionKey
|
||||
{
|
||||
boolean ok = true;
|
||||
private boolean cancelled = false;
|
||||
|
||||
/**
|
||||
* Initializes the key.
|
||||
|
@ -59,10 +59,12 @@ public abstract class AbstractSelectionKey
|
|||
*/
|
||||
public final void cancel ()
|
||||
{
|
||||
if (ok)
|
||||
selector ().selectedKeys ().add (this);
|
||||
|
||||
ok = false;
|
||||
if (isValid())
|
||||
{
|
||||
// FIXME: implement this.
|
||||
//selector().cancelledKeys().add (this);
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,6 +72,6 @@ public abstract class AbstractSelectionKey
|
|||
*/
|
||||
public final boolean isValid ()
|
||||
{
|
||||
return ok;
|
||||
return !cancelled;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue