public abstract class Selector extends Object
Modifier | Constructor and Description |
---|---|
protected |
Selector()
Initializes the selector.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Closes the selector.
|
abstract boolean |
isOpen()
Tells whether the selector is open or not.
|
abstract Set<SelectionKey> |
keys()
Returns this selector's key set.
|
static Selector |
open()
Opens a selector.
|
abstract SelectorProvider |
provider()
Returns the SelectorProvider that created the selector.
|
abstract int |
select()
Selects a set of keys whose corresponding channels are ready
for I/O operations.
|
abstract int |
select(long timeout)
Selects a set of keys whose corresponding channels are ready
for I/O operations.
|
abstract Set<SelectionKey> |
selectedKeys()
Returns this selector's selected-key set.
|
abstract int |
selectNow()
Selects a set of keys whose corresponding channels are ready
for I/O operations.
|
abstract Selector |
wakeup()
Causes the first selection operation that has not yet returned to
return immediately.
|
protected Selector()
public static Selector open() throws IOException
IOException
- If an error occurspublic abstract void close() throws IOException
IOException
- If an error occurspublic abstract boolean isOpen()
public abstract Set<SelectionKey> keys()
ClosedSelectorException
- If this selector is closed.public abstract SelectorProvider provider()
public abstract int select() throws IOException
ClosedSelectorException
- If this selector is closed.IOException
- If an error occurspublic abstract int select(long timeout) throws IOException
timeout
- The timeout to use.ClosedSelectorException
- If this selector is closed.IllegalArgumentException
- If the timeout value is negative.IOException
- If an error occurspublic abstract Set<SelectionKey> selectedKeys()
ClosedSelectorException
- If this selector is closed.public abstract int selectNow() throws IOException
ClosedSelectorException
- If this selector is closed.IOException
- If an error occurs