Class AbstractNioWorkerPool<E extends AbstractNioWorker>
java.lang.Object
org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool<E>
- All Implemented Interfaces:
NioSelectorPool, WorkerPool<E>, ExternalResourceReleasable
- Direct Known Subclasses:
NioDatagramWorkerPool, NioWorkerPool
public abstract class AbstractNioWorkerPool<E extends AbstractNioWorker>
extends Object
implements WorkerPool<E>, ExternalResourceReleasable
Abstract base class for
WorkerPool implementations that create the Worker's
up-front and return them in a "fair" fashion when calling nextWorker()-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intThe worker pool raises an exception unless all worker threads start and run within this timeout (in seconds.)private final AtomicBooleanprivate static final InternalLoggerprivate final Executorprivate final AtomicIntegerprivate final AbstractNioWorker[] -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNioWorkerPool(Executor workerExecutor, int workerCount) Create a new instanceAbstractNioWorkerPool(Executor workerExecutor, int workerCount, boolean autoInit) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidinit()protected abstract EReturn the nextWorkerto usevoidvoidReleases the external resources that this object depends on.voidshutdown()Shutdown theNioSelectorPooland all internal created resourcesprivate void
-
Field Details
-
INITIALIZATION_TIMEOUT
private static final int INITIALIZATION_TIMEOUTThe worker pool raises an exception unless all worker threads start and run within this timeout (in seconds.)- See Also:
-
logger
-
workers
-
workerIndex
-
workerExecutor
-
initialized
-
-
Constructor Details
-
AbstractNioWorkerPool
-
AbstractNioWorkerPool
AbstractNioWorkerPool(Executor workerExecutor, int workerCount, boolean autoInit)
-
-
Method Details
-
init
protected void init() -
waitForWorkerThreads
private void waitForWorkerThreads() -
newWorker
-
nextWorker
Description copied from interface:WorkerPoolReturn the nextWorkerto use- Specified by:
nextWorkerin interfaceWorkerPool<E extends AbstractNioWorker>- Returns:
- worker
-
rebuildSelectors
public void rebuildSelectors()Description copied from interface:NioSelectorPoolReplaces the currentSelectors of theBosses with newSelectors to work around the infamous epoll 100% CPU bug.- Specified by:
rebuildSelectorsin interfaceNioSelectorPool
-
releaseExternalResources
public void releaseExternalResources()Description copied from interface:ExternalResourceReleasableReleases the external resources that this object depends on. You should not call this method if the external resources (e.g. thread pool) are in use by other objects.- Specified by:
releaseExternalResourcesin interfaceExternalResourceReleasable
-
shutdown
public void shutdown()Description copied from interface:NioSelectorPoolShutdown theNioSelectorPooland all internal created resources- Specified by:
shutdownin interfaceNioSelectorPool
-