| Modifier and Type | Field and Description |
|---|---|
private java.util.HashSet<Selectable> |
error |
private java.util.HashSet<Selectable> |
expired |
private java.util.HashSet<Selectable> |
readable |
private java.util.HashSet<Selectable> |
selectables |
private java.nio.channels.Selector |
selector |
private java.util.HashSet<Selectable> |
writeable |
| Modifier | Constructor and Description |
|---|---|
protected |
SelectorImpl(IO io) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Selectable selectable)
Adds a selectable to the selector.
|
java.util.Iterator<Selectable> |
error() |
java.util.Iterator<Selectable> |
expired() |
void |
free()
Frees the resources used by this selector.
|
java.util.Iterator<Selectable> |
readable() |
void |
remove(Selectable selectable)
Removes a selectable from the selector.
|
void |
select(long timeout)
Waits for the specified timeout period for one or more selectables to
become ready for an operation.
|
void |
update(Selectable selectable)
Updates the selector to reflect any changes interest by the specified
selectable.
|
java.util.Iterator<Selectable> |
writeable() |
private final java.nio.channels.Selector selector
private final java.util.HashSet<Selectable> selectables
private final java.util.HashSet<Selectable> readable
private final java.util.HashSet<Selectable> writeable
private final java.util.HashSet<Selectable> expired
private final java.util.HashSet<Selectable> error
protected SelectorImpl(IO io) throws java.io.IOException
java.io.IOExceptionpublic void add(Selectable selectable) throws java.io.IOException
Selectorpublic void update(Selectable selectable)
SelectorSelectable.isReading() and Selectable.isWriting()
methods.public void remove(Selectable selectable)
Selectorpublic void select(long timeout)
throws java.io.IOException
SelectorSelector.readable(), Selector.writeable(),
Selector.expired(), or Selector.error() methods.public java.util.Iterator<Selectable> readable()
readable in interface SelectorSelector.select(long). Calling select clears
any previous values in this set before adding new values
corresponding to those selectables that have become readable.public java.util.Iterator<Selectable> writeable()
writeable in interface SelectorSelector.select(long). Calling select clears
any previous values in this set before adding new values
corresponding to those selectables that have become writable.public java.util.Iterator<Selectable> expired()
expired in interface SelectorSelector.select(long). Calling select clears
any previous values in this set before adding new values
corresponding to those selectables that have now expired.public java.util.Iterator<Selectable> error()
error in interface SelectorSelector.select(long). Calling select
clears any previous values in this set before adding new values
corresponding to those selectables that have encountered an
error.