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 int
private static final int
private final Executor
Executor used to executeRunnable
s such as channel registration task.private final int
protected static final InternalLogger
Internal Netty logger.private static final AtomicInteger
protected Selector
The NIOSelector
.private boolean
private final CountDownLatch
(package private) final CountDownLatch
Count down to 0 when the I/O thread starts andthread
is set to non-null.protected Thread
If this worker has been started thread will be a reference to the thread used when starting.protected final AtomicBoolean
Boolean 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 boolean
protected abstract void
protected abstract Runnable
createRegisterTask
(Channel channel, ChannelFuture future) protected final void
protected final boolean
protected abstract ThreadRenamingRunnable
newThreadRenamingRunnable
(int id, ThreadNameDeterminer determiner) private void
openSelector
(ThreadNameDeterminer determiner) Start theAbstractNioWorker
and return theSelector
that will be used for theAbstractNioChannel
's when they get registeredprotected abstract void
private void
void
void
register
(Channel channel, ChannelFuture future) protected final void
registerTask
(Runnable task) void
run()
protected int
void
shutdown()
-
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 executeRunnable
s 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 andthread
is 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:
register
in interfaceNioSelector
-
registerTask
-
isIoThread
protected final boolean isIoThread() -
rebuildSelector
public void rebuildSelector()Description copied from interface:NioSelector
- Specified by:
rebuildSelector
in interfaceNioSelector
-
run
public void run() -
openSelector
Start theAbstractNioWorker
and return theSelector
that 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:
shutdown
in interfaceNioSelector
-
process
- Throws:
IOException
-
select
- Throws:
IOException
-
close
-
newThreadRenamingRunnable
protected abstract ThreadRenamingRunnable newThreadRenamingRunnable(int id, ThreadNameDeterminer determiner) -
createRegisterTask
-