public class ManagedSelector extends ContainerLifeCycle implements Dumpable
ManagedSelector
wraps a Selector
simplifying non-blocking operations on channels.
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.
Modifier and Type | Class and Description |
---|---|
static interface |
ManagedSelector.Selectable
A
ManagedSelector.Selectable is an EndPoint that wish to be
notified of non-blocking events by the ManagedSelector . |
static interface |
ManagedSelector.SelectorUpdate
A selector update to be done when the selector has been woken.
|
AbstractLifeCycle.AbstractLifeCycleListener
Container.InheritedListener, Container.Listener
LifeCycle.Listener
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
Constructor and Description |
---|
ManagedSelector(SelectorManager selectorManager,
int id) |
Modifier and Type | Method and Description |
---|---|
void |
destroyEndPoint(EndPoint endPoint) |
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
void |
dump(java.lang.Appendable out,
java.lang.String indent) |
java.nio.channels.Selector |
getSelector() |
int |
size() |
void |
submit(ManagedSelector.SelectorUpdate update)
Submit an
ManagedSelector.SelectorUpdate to be acted on between calls to Selector.select() |
java.lang.String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public ManagedSelector(SelectorManager selectorManager, int id)
public java.nio.channels.Selector getSelector()
protected void doStart() throws java.lang.Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
java.lang.Exception
public int size()
protected void doStop() throws java.lang.Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
java.lang.Exception
public void submit(ManagedSelector.SelectorUpdate update)
ManagedSelector.SelectorUpdate
to be acted on between calls to Selector.select()
update
- The selector update to apply at next wakeuppublic void destroyEndPoint(EndPoint endPoint)
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
dump
in interface Dumpable
dump
in class ContainerLifeCycle
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2019 Webtide. All rights reserved.