public class SelectorManager.ManagedSelector extends AbstractLifeCycle implements Runnable, Dumpable
SelectorManager.ManagedSelector wraps a Selector simplifying non-blocking operations on channels.
SelectorManager.ManagedSelector runs the select loop, which waits on Selector.select() until events
happen for registered channels. When events happen, it notifies the EndPoint associated
with the channel.
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener| Constructor and Description |
|---|
SelectorManager.ManagedSelector(int id) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroyEndPoint(EndPoint endPoint) |
protected void |
doStart() |
protected void |
doStop() |
String |
dump() |
void |
dump(Appendable out,
String indent) |
void |
dumpKeysState(List<Object> dumps) |
boolean |
isSelectorThread() |
void |
run() |
protected void |
runChange(Runnable change) |
void |
select()
Process changes and waits on
Selector.select(). |
void |
submit(Runnable change)
Submits a change to be executed in the selector thread.
|
String |
toString() |
void |
updateKey(Runnable update)
Submit a task to update a selector key.
|
void |
wakeup() |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stopprotected void doStart()
throws Exception
doStart in class AbstractLifeCycleExceptionprotected void doStop()
throws Exception
doStop in class AbstractLifeCycleExceptionpublic void updateKey(Runnable update)
SelectorManager.SUBMIT_KEY_UPDATES
is set true (default is false), the task is passed to submit(Runnable). Otherwise it is run immediately and the selector
woken up if need be.update - the update to a keypublic void submit(Runnable change)
Submits a change to be executed in the selector thread.
Changes may be submitted from any thread, and the selector thread woken up (if necessary) to execute the change.
change - the change to submitprotected void runChange(Runnable change)
public void select()
Process changes and waits on Selector.select().
submit(Runnable)public void wakeup()
public boolean isSelectorThread()
public void destroyEndPoint(EndPoint endPoint)
public void dump(Appendable out, String indent) throws IOException
dump in interface DumpableIOExceptionCopyright © 1995-2015 Webtide. All Rights Reserved.