com.threerings.nio
Class SelectorIterable
java.lang.Object
com.threerings.nio.SelectorIterable
- All Implemented Interfaces:
- Iterable<SelectionKey>
public class SelectorIterable
- extends Object
- implements Iterable<SelectionKey>
Exposes selected keys from Selector.selectedKeys() as an Iterable, removing them from the
selected set as they're iterated over.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MAX_SELECT_FAILURES
public static final int MAX_SELECT_FAILURES
- The maximum allowed consecutive select() failures, after which we will declare ourselves
irreparably hosed.
- See Also:
- Constant Field Values
_runtimeExceptionCount
protected int _runtimeExceptionCount
_selectLoopTime
protected final int _selectLoopTime
_selector
protected final Selector _selector
_failureHandler
protected final SelectorIterable.SelectFailureHandler _failureHandler
SelectorIterable
public SelectorIterable(Selector selector,
int selectLoopTime,
SelectorIterable.SelectFailureHandler handler)
- Creates an iterable for the given selector's selectedKeys.
- Parameters:
selectLoopTime - - the amount of time to wait in select, or 0 to skip the wait at all.handler - - a callback for the Selector going awol.
iterator
public Iterator<SelectionKey> iterator()
- Specified by:
iterator in interface Iterable<SelectionKey>
select
protected Set<SelectionKey> select()