public class NioWorker extends Object
Modifier and Type | Field and Description |
---|---|
protected static InternalLogger |
logger
Internal Netty logger.
|
protected Selector |
selector
The NIO
Selector . |
protected org.jboss.netty.channel.socket.nio.SocketSendBufferPool |
sendBufferPool |
protected Thread |
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.
|
protected AtomicBoolean |
wakenUp
Boolean that controls determines if a blocked Selector.select should
break out of its selection process.
|
Constructor and Description |
---|
NioWorker(Executor executor) |
NioWorker(Executor executor,
ThreadNameDeterminer determiner) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
cleanUpCancelledKeys() |
protected static void |
cleanUpWriteBuffer(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) |
protected void |
clearOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) |
protected void |
close(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel,
ChannelFuture future) |
protected void |
close(SelectionKey k) |
protected Runnable |
createRegisterTask(Channel channel,
ChannelFuture future) |
void |
executeInIoThread(Runnable task)
Execute the given
Runnable in the IO-Thread. |
void |
executeInIoThread(Runnable task,
boolean alwaysAsync)
Execute the
Runnable in a IO-Thread |
protected void |
increaseCancelledKeys() |
protected boolean |
isIoThread() |
protected ThreadRenamingRunnable |
newThreadRenamingRunnable(int id,
ThreadNameDeterminer determiner) |
protected void |
process(Selector selector) |
protected boolean |
read(SelectionKey k)
Read is called when a Selector has been notified that the underlying channel
was something to be read.
|
void |
rebuildSelector()
|
void |
register(Channel channel,
ChannelFuture future) |
protected void |
registerTask(Runnable task) |
void |
run() |
protected boolean |
scheduleWriteIfNecessary(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) |
protected int |
select(Selector selector) |
protected void |
setOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) |
void |
shutdown() |
protected void |
write0(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) |
protected final org.jboss.netty.channel.socket.nio.SocketSendBufferPool sendBufferPool
protected static final InternalLogger logger
protected volatile Thread thread
protected final AtomicBoolean wakenUp
public NioWorker(Executor executor)
public NioWorker(Executor executor, ThreadNameDeterminer determiner)
protected boolean read(SelectionKey k)
k
- The selection key which contains the Selector registration information.protected boolean scheduleWriteIfNecessary(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel)
protected Runnable createRegisterTask(Channel channel, ChannelFuture future)
public void executeInIoThread(Runnable task)
Worker
Runnable
in the IO-Thread. This may be now or
later once the IO-Thread do some other work.executeInIoThread
in interface Worker
task
- the Runnable
to executepublic void executeInIoThread(Runnable task, boolean alwaysAsync)
Runnable
in a IO-Threadprotected void close(SelectionKey k)
protected ThreadRenamingRunnable newThreadRenamingRunnable(int id, ThreadNameDeterminer determiner)
protected void process(Selector selector) throws IOException
IOException
protected void write0(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel)
protected void setOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel)
protected void clearOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel)
protected void close(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel, ChannelFuture future)
protected static void cleanUpWriteBuffer(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel)
public void register(Channel channel, ChannelFuture future)
register
in interface NioSelector
protected final void registerTask(Runnable task)
protected final boolean isIoThread()
public void rebuildSelector()
NioSelector
rebuildSelector
in interface NioSelector
protected final void increaseCancelledKeys()
protected final boolean cleanUpCancelledKeys() throws IOException
IOException
public void shutdown()
shutdown
in interface NioSelector
protected int select(Selector selector) throws IOException
IOException
Copyright © 2008-2015 The Netty Project. All Rights Reserved.