Package org.restlet.engine.io
Class SelectorFactory
- java.lang.Object
-
- org.restlet.engine.io.SelectorFactory
-
public class SelectorFactory extends java.lang.ObjectFactory used to dispatch/shareSelector.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_ATTEMPTSThe number of attempts to find an available selector.static intMAX_SELECTORSThe maximum number ofSelectorto create.private static java.util.Stack<java.nio.channels.Selector>SELECTORSCache ofSelector.static longTIMEOUTThe timeout before we exit.
-
Constructor Summary
Constructors Constructor Description SelectorFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.nio.channels.SelectorgetSelector()Get an exclusiveSelector.static voidreturnSelector(java.nio.channels.Selector selector)Returns theSelectorto the cache.
-
-
-
Field Detail
-
MAX_SELECTORS
public static final int MAX_SELECTORS
The maximum number ofSelectorto create.- See Also:
- Constant Field Values
-
MAX_ATTEMPTS
public static final int MAX_ATTEMPTS
The number of attempts to find an available selector.- See Also:
- Constant Field Values
-
SELECTORS
private static final java.util.Stack<java.nio.channels.Selector> SELECTORS
Cache ofSelector.
-
TIMEOUT
public static final long TIMEOUT
The timeout before we exit.- See Also:
- Constant Field Values
-
-
Method Detail
-
getSelector
public static final java.nio.channels.Selector getSelector()
Get an exclusiveSelector.- Returns:
- An exclusive
Selector.
-
returnSelector
public static final void returnSelector(java.nio.channels.Selector selector)
Returns theSelectorto the cache.- Parameters:
selector- TheSelectorto return.
-
-