Selects a set of keys whose corresponding channels are ready for I/O
operations.
This method performs a blocking selection
operation. It returns only after at least one channel is selected,
this selector's wakeup
method is invoked, the current
thread is interrupted, or the given timeout period expires, whichever
comes first.
This method does not offer real-time guarantees: It schedules the
timeout as if by invoking the Object.wait(long)
method.
Returns:
The number of keys, possibly zero,
whose ready-operation sets were updated
Parameters:
-
timeout - If positive, block for up to
timeout
milliseconds, more or less, while waiting for a
channel to become ready; if zero, block indefinitely;
must not be negative
Throws:
-
IOException - If an I/O error occurs
-
ClosedSelectorException - If this selector is closed
-
IllegalArgumentException - If the value of the timeout argument is negative