Package com.google.code.yanf4j.util
Class SelectorFactory
java.lang.Object
com.google.code.yanf4j.util.SelectorFactory
Temp selector factory,come from grizzly
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
private static final org.slf4j.Logger
private static int
The number ofSelector
to create.Cache ofSelector
static final long
The timeout before we exit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final int
Returns max selector pool sizestatic final Selector
Get a exclusiveSelector
private static void
grow
(int size) IncreaseSelector
pool sizeprivate static void
reduce
(int size) DecreaseSelector
pool sizestatic final void
Return theSelector
to the cachestatic final void
setMaxSelectors
(int size) Set max selector pool size.
-
Field Details
-
DEFAULT_MAX_SELECTORS
public static final int DEFAULT_MAX_SELECTORS- See Also:
-
logger
private static final org.slf4j.Logger logger -
timeout
public static final long timeoutThe timeout before we exit.- See Also:
-
maxSelectors
private static int maxSelectorsThe number ofSelector
to create. -
selectors
Cache ofSelector
-
-
Constructor Details
-
SelectorFactory
public SelectorFactory()
-
-
Method Details
-
setMaxSelectors
Set max selector pool size.- Parameters:
size
- max pool size- Throws:
IOException
-
getMaxSelectors
public static final int getMaxSelectors()Returns max selector pool size- Returns:
- max pool size
-
getSelector
Get a exclusiveSelector
- Returns:
Selector
-
returnSelector
Return theSelector
to the cache- Parameters:
s
-Selector
-
grow
IncreaseSelector
pool size- Throws:
IOException
-
reduce
private static void reduce(int size) DecreaseSelector
pool size
-