Package org.eclipse.jetty.io
Class ManagedSelector
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.io.ManagedSelector
-
public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dumpable
ManagedSelectorwraps aSelectorsimplifying non-blocking operations on channels.ManagedSelectorruns the select loop, which waits onSelector.select()until events happen for registered channels. When events happen, it notifies theEndPointassociated with the channel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceManagedSelector.SelectableEndPointAManagedSelector.SelectableEndPointis anEndPointthat wish to be notified of non-blocking events by theManagedSelector.-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
-
-
Constructor Summary
Constructors Constructor Description ManagedSelector(SelectorManager selectorManager, int id)ManagedSelector(SelectorManager selectorManager, int id, ExecutionStrategy.Factory executionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroyEndPoint(EndPoint endPoint)protected voiddoStart()protected voiddoStop()Stringdump()voiddump(Appendable out, String indent)ExecutionStrategygetExecutionStrategy()SelectorgetSelector()protected SelectornewSelector()protected voidonSelectFailed(Throwable cause)voidrun()intsize()protected voidstartSelector()voidsubmit(Runnable change)StringtoString()-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
-
-
-
-
Constructor Detail
-
ManagedSelector
public ManagedSelector(SelectorManager selectorManager, int id)
-
ManagedSelector
public ManagedSelector(SelectorManager selectorManager, int id, ExecutionStrategy.Factory executionFactory)
-
-
Method Detail
-
getExecutionStrategy
public ExecutionStrategy getExecutionStrategy()
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classAbstractLifeCycle- Throws:
Exception
-
startSelector
protected void startSelector() throws IOException- Throws:
IOException
-
newSelector
protected Selector newSelector() throws IOException
- Throws:
IOException
-
getSelector
public Selector getSelector()
-
onSelectFailed
protected void onSelectFailed(Throwable cause) throws IOException
- Throws:
IOException
-
size
public int size()
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classAbstractLifeCycle- Throws:
Exception
-
submit
public void submit(Runnable change)
-
destroyEndPoint
public void destroyEndPoint(EndPoint endPoint)
-
dump
public void dump(Appendable out, String indent) throws IOException
- Specified by:
dumpin interfaceDumpable- Throws:
IOException
-
-