public abstract class AbstractNioBossPool<E extends Boss> extends java.lang.Object implements BossPool<E>, ExternalResourceReleasable
| Modifier and Type | Field and Description |
|---|---|
private Boss[] |
bosses |
private java.util.concurrent.Executor |
bossExecutor |
private java.util.concurrent.atomic.AtomicInteger |
bossIndex |
private static int |
INITIALIZATION_TIMEOUT
The boss pool raises an exception unless all boss threads start and run within this timeout (in seconds.)
|
private java.util.concurrent.atomic.AtomicBoolean |
initialized |
private static InternalLogger |
logger |
| Constructor and Description |
|---|
AbstractNioBossPool(java.util.concurrent.Executor bossExecutor,
int bossCount)
Create a new instance
|
AbstractNioBossPool(java.util.concurrent.Executor bossExecutor,
int bossCount,
boolean autoInit) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
init() |
protected abstract E |
newBoss(java.util.concurrent.Executor executor)
Create a new
Boss which uses the given Executor to service IO |
E |
nextBoss()
Return the next
Boss to use |
void |
rebuildSelectors()
Replaces the current
Selectors of the Bosses with new Selectors to work around the
infamous epoll 100% CPU bug. |
void |
releaseExternalResources()
Releases the external resources that this object depends on.
|
void |
shutdown()
Shutdown the
NioSelectorPool and all internal created resources |
private void |
waitForBossThreads() |
private static final int INITIALIZATION_TIMEOUT
private static final InternalLogger logger
private final Boss[] bosses
private final java.util.concurrent.atomic.AtomicInteger bossIndex
private final java.util.concurrent.Executor bossExecutor
private final java.util.concurrent.atomic.AtomicBoolean initialized
AbstractNioBossPool(java.util.concurrent.Executor bossExecutor,
int bossCount)
AbstractNioBossPool(java.util.concurrent.Executor bossExecutor,
int bossCount,
boolean autoInit)
protected void init()
private void waitForBossThreads()
protected abstract E newBoss(java.util.concurrent.Executor executor)
Boss which uses the given Executor to service IOexecutor - the Executor to useBosspublic E nextBoss()
BossPoolBoss to usepublic void rebuildSelectors()
NioSelectorPoolSelectors of the Bosses with new Selectors to work around the
infamous epoll 100% CPU bug.rebuildSelectors in interface NioSelectorPoolpublic void releaseExternalResources()
ExternalResourceReleasablereleaseExternalResources in interface ExternalResourceReleasablepublic void shutdown()
NioSelectorPoolNioSelectorPool and all internal created resourcesshutdown in interface NioSelectorPool