Class AbstractNioSelector
java.lang.Object
org.jboss.netty.channel.socket.nio.AbstractNioSelector
- All Implemented Interfaces:
Runnable,NioSelector
- Direct Known Subclasses:
AbstractNioWorker,NioClientBoss,NioServerBoss
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate static final intprivate final ExecutorExecutor used to executeRunnables such as channel registration task.private final intprotected static final InternalLoggerInternal Netty logger.private static final AtomicIntegerprotected SelectorThe NIOSelector.private booleanprivate final CountDownLatch(package private) final CountDownLatchCount down to 0 when the I/O thread starts andthreadis set to non-null.protected ThreadIf this worker has been started thread will be a reference to the thread used when starting.protected final AtomicBooleanBoolean that controls determines if a blocked Selector.select should break out of its selection process. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNioSelector(Executor executor) AbstractNioSelector(Executor executor, ThreadNameDeterminer determiner) -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanprotected abstract voidprotected abstract RunnablecreateRegisterTask(Channel channel, ChannelFuture future) protected final voidprotected final booleanprotected abstract ThreadRenamingRunnablenewThreadRenamingRunnable(int id, ThreadNameDeterminer determiner) private voidopenSelector(ThreadNameDeterminer determiner) Start theAbstractNioWorkerand return theSelectorthat will be used for theAbstractNioChannel's when they get registeredprotected abstract voidprivate voidvoidvoidregister(Channel channel, ChannelFuture future) protected final voidregisterTask(Runnable task) voidrun()protected intvoidshutdown()
-
Field Details
-
nextId
-
id
private final int id -
logger
Internal Netty logger. -
CLEANUP_INTERVAL
private static final int CLEANUP_INTERVAL- See Also:
-
executor
Executor used to executeRunnables such as channel registration task. -
thread
If this worker has been started thread will be a reference to the thread used when starting. i.e. the current thread when the run method is executed. -
startupLatch
Count down to 0 when the I/O thread starts andthreadis set to non-null. -
selector
The NIOSelector. -
wakenUp
Boolean that controls determines if a blocked Selector.select should break out of its selection process. In our case we use a timeone for the select method and the select method will block for that time unless waken up. -
taskQueue
-
cancelledKeys
private volatile int cancelledKeys -
shutdownLatch
-
shutdown
private volatile boolean shutdown
-
-
Constructor Details
-
AbstractNioSelector
AbstractNioSelector(Executor executor) -
AbstractNioSelector
AbstractNioSelector(Executor executor, ThreadNameDeterminer determiner)
-
-
Method Details
-
register
- Specified by:
registerin interfaceNioSelector
-
registerTask
-
isIoThread
protected final boolean isIoThread() -
rebuildSelector
public void rebuildSelector()Description copied from interface:NioSelector- Specified by:
rebuildSelectorin interfaceNioSelector
-
run
public void run() -
openSelector
Start theAbstractNioWorkerand return theSelectorthat will be used for theAbstractNioChannel's when they get registered -
processTaskQueue
private void processTaskQueue() -
increaseCancelledKeys
protected final void increaseCancelledKeys() -
cleanUpCancelledKeys
- Throws:
IOException
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceNioSelector
-
process
- Throws:
IOException
-
select
- Throws:
IOException
-
close
-
newThreadRenamingRunnable
protected abstract ThreadRenamingRunnable newThreadRenamingRunnable(int id, ThreadNameDeterminer determiner) -
createRegisterTask
-