Top Fields Constructors Methods
org.glassfish.grizzly.nio.tmpselectors

public Class TemporarySelectorPool

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.channels.Selector, java.nio.channels.spi.SelectorProvider, java.util.Queue, java.util.concurrent.ConcurrentLinkedQueue, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger, java.util.logging.Level, .Logger, org.glassfish.grizzly.Grizzly, org.glassfish.grizzly.localization.LogMessages, org.glassfish.grizzly.nio.Selectors

Author
oleksiys

Field Summary

Modifier and TypeField and Description
public static final int
private final AtomicBoolean
private static final Logger
private volatile int
maxPoolSize

The max number of Selector to create.

private static final int
private final AtomicInteger
missesCounter

Number of times poll execution didn't find the available selector in the pool.

private final AtomicInteger
poolSize

The current number of Selectors in the pool.

private final SelectorProvider
private final Queue<Selector>
selectors

Cache of Selector

Constructor Summary

AccessConstructor and Description
public
TemporarySelectorPool(final SelectorProvider selectorProvider)

public
TemporarySelectorPool(final SelectorProvider selectorProvider, final int selectorsCount)

Method Summary

Modifier and TypeMethod and Description
private Selector
checkSelector(final Selector selector)

public synchronized void
private void
public SelectorProvider
public void
offer(Selector selector)

public Selector
poll()

public synchronized void
setSize(int size)

public synchronized int
size()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_SELECTORS_COUNTback to summary
public static final int DEFAULT_SELECTORS_COUNT
isClosedback to summary
private final AtomicBoolean isClosed
LOGGERback to summary
private static final Logger LOGGER
maxPoolSizeback to summary
private volatile int maxPoolSize

The max number of Selector to create.

MISS_THRESHOLDback to summary
private static final int MISS_THRESHOLD
missesCounterback to summary
private final AtomicInteger missesCounter

Number of times poll execution didn't find the available selector in the pool.

poolSizeback to summary
private final AtomicInteger poolSize

The current number of Selectors in the pool.

selectorProviderback to summary
private final SelectorProvider selectorProvider
selectorsback to summary
private final Queue<Selector> selectors

Cache of Selector

Constructor Detail

TemporarySelectorPoolback to summary
public TemporarySelectorPool(final SelectorProvider selectorProvider)
TemporarySelectorPoolback to summary
public TemporarySelectorPool(final SelectorProvider selectorProvider, final int selectorsCount)

Method Detail

checkSelectorback to summary
private Selector checkSelector(final Selector selector)
closeback to summary
public synchronized void close()
closeSelectorback to summary
private void closeSelector(Selector selector)
getSelectorProviderback to summary
public SelectorProvider getSelectorProvider()
offerback to summary
public void offer(Selector selector)
pollback to summary
public Selector poll() throws IOException
setSizeback to summary
public synchronized void setSize(int size) throws IOException
sizeback to summary
public synchronized int size()