Package org.eclipse.jetty.io
Class ManagedSelector
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.io.ManagedSelector
-
- All Implemented Interfaces:
Container,Destroyable,Dumpable,LifeCycle
public class ManagedSelector extends ContainerLifeCycle implements 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.SelectableAManagedSelector.Selectableis anEndPointthat wish to be notified of non-blocking events by theManagedSelector.static interfaceManagedSelector.SelectorUpdateA selector update to be done when the selector has been woken.-
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.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Constructor Summary
Constructors Constructor Description ManagedSelector(SelectorManager selectorManager, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroyEndPoint(EndPoint endPoint)protected voiddoStart()protected voiddoStop()voiddump(java.lang.Appendable out, java.lang.String indent)protected voidendPointClosed(EndPoint endPoint)protected voidendPointOpened(EndPoint endPoint)java.nio.channels.SelectorgetSelector()protected voidonSelectFailed(java.lang.Throwable cause)intsize()voidsubmit(ManagedSelector.SelectorUpdate update)Submit anManagedSelector.SelectorUpdateto be acted on between calls toSelector.select()java.lang.StringtoString()-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
-
-
-
Constructor Detail
-
ManagedSelector
public ManagedSelector(SelectorManager selectorManager, int id)
-
-
Method Detail
-
getSelector
public java.nio.channels.Selector getSelector()
-
doStart
protected void doStart() throws java.lang.Exception- Overrides:
doStartin classContainerLifeCycle- Throws:
java.lang.Exception
-
onSelectFailed
protected void onSelectFailed(java.lang.Throwable cause)
-
size
public int size()
-
doStop
protected void doStop() throws java.lang.Exception- Overrides:
doStopin classContainerLifeCycle- Throws:
java.lang.Exception
-
submit
public void submit(ManagedSelector.SelectorUpdate update)
Submit anManagedSelector.SelectorUpdateto be acted on between calls toSelector.select()- Parameters:
update- The selector update to apply at next wakeup
-
endPointOpened
protected void endPointOpened(EndPoint endPoint)
-
endPointClosed
protected void endPointClosed(EndPoint endPoint)
-
destroyEndPoint
public void destroyEndPoint(EndPoint endPoint)
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException- Specified by:
dumpin interfaceDumpable- Overrides:
dumpin classContainerLifeCycle- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractLifeCycle
-
-