public class NioWorker
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected static InternalLogger |
logger
Internal Netty logger.
|
protected java.nio.channels.Selector |
selector
The NIO
Selector . |
protected org.jboss.netty.channel.socket.nio.SocketSendBufferPool |
sendBufferPool |
protected java.lang.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 java.util.concurrent.atomic.AtomicBoolean |
wakenUp
Boolean that controls determines if a blocked Selector.select should
break out of its selection process.
|
构造器和说明 |
---|
NioWorker(java.util.concurrent.Executor executor) |
NioWorker(java.util.concurrent.Executor executor,
ThreadNameDeterminer determiner) |
限定符和类型 | 方法和说明 |
---|---|
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(java.nio.channels.SelectionKey k) |
protected java.lang.Runnable |
createRegisterTask(Channel channel,
ChannelFuture future) |
void |
executeInIoThread(java.lang.Runnable task)
Execute the given
Runnable in the IO-Thread. |
void |
executeInIoThread(java.lang.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(java.nio.channels.Selector selector) |
protected boolean |
read(java.nio.channels.SelectionKey k)
Read is called when a Selector has been notified that the underlying channel
was something to be read.
|
void |
rebuildSelector()
Replaces the current
Selector with a new Selector to work around the infamous epoll 100% CPU
bug. |
void |
register(Channel channel,
ChannelFuture future) |
protected void |
registerTask(java.lang.Runnable task) |
void |
run() |
protected boolean |
scheduleWriteIfNecessary(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) |
protected int |
select(java.nio.channels.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 java.lang.Thread thread
protected volatile java.nio.channels.Selector selector
Selector
.protected final java.util.concurrent.atomic.AtomicBoolean wakenUp
public NioWorker(java.util.concurrent.Executor executor)
public NioWorker(java.util.concurrent.Executor executor, ThreadNameDeterminer determiner)
protected boolean read(java.nio.channels.SelectionKey k)
k
- The selection key which contains the Selector registration information.protected boolean scheduleWriteIfNecessary(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel)
protected java.lang.Runnable createRegisterTask(Channel channel, ChannelFuture future)
public void run()
run
在接口中 java.lang.Runnable
public void executeInIoThread(java.lang.Runnable task)
Worker
Runnable
in the IO-Thread. This may be now or
later once the IO-Thread do some other work.executeInIoThread
在接口中 Worker
task
- the Runnable
to executepublic void executeInIoThread(java.lang.Runnable task, boolean alwaysAsync)
Runnable
in a IO-Threadtask
- the Runnable
to executealwaysAsync
- true
if the Runnable
should be executed
in an async fashion even if the current Thread == IO Threadprotected void close(java.nio.channels.SelectionKey k)
protected ThreadRenamingRunnable newThreadRenamingRunnable(int id, ThreadNameDeterminer determiner)
protected void process(java.nio.channels.Selector selector) throws java.io.IOException
java.io.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
在接口中 NioSelector
protected final void registerTask(java.lang.Runnable task)
protected final boolean isIoThread()
public void rebuildSelector()
NioSelector
Selector
with a new Selector
to work around the infamous epoll 100% CPU
bug.rebuildSelector
在接口中 NioSelector
protected final void increaseCancelledKeys()
protected final boolean cleanUpCancelledKeys() throws java.io.IOException
java.io.IOException
public void shutdown()
shutdown
在接口中 NioSelector
protected int select(java.nio.channels.Selector selector) throws java.io.IOException
java.io.IOException