1 |
/* AbstractSelectionKey.java |
/* AbstractSelectionKey.java -- |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
|
|
|
38 |
package java.nio.channels.spi; |
package java.nio.channels.spi; |
39 |
|
|
40 |
import java.nio.channels.*; |
import java.nio.channels.SelectionKey; |
|
import java.util.*; |
|
|
|
|
41 |
|
|
42 |
public abstract class AbstractSelectionKey |
public abstract class AbstractSelectionKey |
43 |
extends SelectionKey |
extends SelectionKey |
44 |
{ |
{ |
45 |
boolean ok = true; |
boolean ok = true; |
46 |
|
|
47 |
protected AbstractSelectionKey() |
protected AbstractSelectionKey () |
48 |
{ |
{ |
49 |
} |
} |
50 |
|
|
51 |
public void cancel() |
public final void cancel () |
52 |
{ |
{ |
53 |
if (ok) |
if (ok) |
54 |
{ |
{ |
55 |
selector().cancelledKeys().add(this); |
selector ().selectedKeys ().add (this); |
56 |
} |
} |
57 |
ok = false; |
|
58 |
} |
ok = false; |
59 |
|
} |
60 |
public boolean isValid() |
|
61 |
{ |
public final boolean isValid () |
62 |
return ok; |
{ |
63 |
} |
return ok; |
64 |
|
} |
65 |
} |
} |
66 |
|
|