com.sun.grizzly.util
Class SelectorFactory

java.lang.Object
  extended by com.sun.grizzly.util.SelectorFactory

public final class SelectorFactory
extends Object

Factory used to dispatch/share Selector.

Author:
Scott Oaks, Jean-Francois Arcand, gustav trede

Field Summary
static int DEFAULT_MAX_SELECTORS
           
 
Constructor Summary
SelectorFactory()
           
 
Method Summary
static int getMaxSelectors()
          Returns max selector pool size
static Selector getSelector()
          Please ensure to use try finally around get and return of selector so avoid leaks.
static void returnSelector(Selector s)
          Please ensure to use try finally around get and return of selector so avoid leaks.
static void selectNowAndReturnSelector(Selector s)
          Executes Selector.selectNow() and returns the Selector to the cache
static void setMaxSelectors(int size)
          Set max selector pool size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_SELECTORS

public static final int DEFAULT_MAX_SELECTORS
See Also:
Constant Field Values
Constructor Detail

SelectorFactory

public SelectorFactory()
Method Detail

setMaxSelectors

public static void setMaxSelectors(int size)
Set max selector pool size.

Parameters:
size - max pool size

getMaxSelectors

public static int getMaxSelectors()
Returns max selector pool size

Returns:
max pool size

getSelector

public static Selector getSelector()
Please ensure to use try finally around get and return of selector so avoid leaks. Get a exclusive Selector

Returns:
Selector

returnSelector

public static void returnSelector(Selector s)
Please ensure to use try finally around get and return of selector so avoid leaks. Return the Selector to the cache

Parameters:
s - Selector

selectNowAndReturnSelector

public static void selectNowAndReturnSelector(Selector s)
Executes Selector.selectNow() and returns the Selector to the cache



Copyright © 2012 Oracle Corporation. All Rights Reserved.