Closes this selector.
Closes this selector.
If a thread is currently blocked in one of this selector's selection methods then it is interrupted as if by
invoking the selector's wakeup method. Any uncancelled keys still associated with this selector are invalidated,
their channels are deregistered, and any other resources associated with this selector are released. If this
selector is already closed then invoking this method has no effect. After a selector is closed, any further attempt
to use it, except by invoking this method or the wakeup method, will cause a ClosedSelectorException
to be raised
as a defect.
Performs an effect with each selected key.
Performs an effect with each selected key.
If the result of effect is true, the key will be removed from the selected-key set, which is usually what you want after successfully handling a selected key.
Performs a blocking select operation.
Performs a blocking select operation.
**Note this will very often block**. This is intended to be used when the effect is locked to an Executor that is
appropriate for this. If the fiber is interrupted while blocked in select
, then wakeup
is used to unblock it.
Dies with ClosedSelectorException
if this selector is closed.
The number of keys, possibly zero, whose ready-operation sets were updated
Performs a blocking select operation.
Performs a blocking select operation.
**Note this will very often block**. This is intended to be used when the effect is locked to an Executor that is
appropriate for this. If the fiber is interrupted while blocked in select
, then wakeup
is used to unblock it.
Dies with ClosedSelectorException
if this selector is closed.
The number of keys, possibly zero, whose ready-operation sets were updated
Selects a set of keys whose corresponding channels are ready for I/O operations.
Selects a set of keys whose corresponding channels are ready for I/O operations. This method performs a non-blocking selection operation. If no channels have become selectable since the previous selection operation then this method immediately returns zero.
The number of keys, possibly zero, whose ready-operation sets were updated by the selection operation.
Returns this selector's selected-key set.
Returns this selector's selected-key set.
Note that the returned set it mutable - keys may be removed from, but not directly added to it. Any attempt to add
an object to the key set will cause an UnsupportedOperationException
to be thrown. The selected-key set is not
thread-safe.
Causes the first selection operation that has not yet returned to return immediately.
Causes the first selection operation that has not yet returned to return immediately.
If another thread is currently blocked in an invocation of the select()
or select(long)
methods then that
invocation will return immediately. If no selection operation is currently in progress then the next invocation of
one of these methods will return immediately unless the selectNow()
method is invoked in the meantime. In any
case the value returned by that invocation may be non-zero. Subsequent invocations of the select()
or
select(long)
methods will block as usual unless this method is invoked again in the meantime. Invoking this
method more than once between two successive selection operations has the same effect as invoking it just once.
A multiplexor of
SelectableChannel
objects.Please thoroughly read the documentation for the underlying Java API before attempting to use this.