Class AbstractNioWorker
- java.lang.Object
-
- org.jboss.netty.channel.socket.nio.AbstractNioSelector
-
- org.jboss.netty.channel.socket.nio.AbstractNioWorker
-
- All Implemented Interfaces:
java.lang.Runnable
,NioSelector
,Worker
- Direct Known Subclasses:
NioDatagramWorker
,NioWorker
abstract class AbstractNioWorker extends AbstractNioSelector implements Worker
-
-
Field Summary
Fields Modifier and Type Field Description protected SocketSendBufferPool
sendBufferPool
-
Fields inherited from class org.jboss.netty.channel.socket.nio.AbstractNioSelector
logger, selector, startupLatch, thread, wakenUp
-
-
Constructor Summary
Constructors Constructor Description AbstractNioWorker(java.util.concurrent.Executor executor)
AbstractNioWorker(java.util.concurrent.Executor executor, ThreadNameDeterminer determiner)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static void
cleanUpWriteBuffer(AbstractNioChannel<?> channel)
protected void
clearOpWrite(AbstractNioChannel<?> channel)
protected void
close(java.nio.channels.SelectionKey k)
protected void
close(AbstractNioChannel<?> channel, ChannelFuture future)
void
executeInIoThread(java.lang.Runnable task)
Execute the givenRunnable
in the IO-Thread.void
executeInIoThread(java.lang.Runnable task, boolean alwaysAsync)
Execute theRunnable
in a IO-Thread(package private) static boolean
isIoThread(AbstractNioChannel<?> channel)
protected ThreadRenamingRunnable
newThreadRenamingRunnable(int id, ThreadNameDeterminer determiner)
protected void
process(java.nio.channels.Selector selector)
protected abstract 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
run()
protected abstract boolean
scheduleWriteIfNecessary(AbstractNioChannel<?> channel)
(package private) void
setInterestOps(AbstractNioChannel<?> channel, ChannelFuture future, int interestOps)
protected void
setOpWrite(AbstractNioChannel<?> channel)
protected void
write0(AbstractNioChannel<?> channel)
(package private) void
writeFromSelectorLoop(java.nio.channels.SelectionKey k)
(package private) void
writeFromTaskLoop(AbstractNioChannel<?> ch)
(package private) void
writeFromUserCode(AbstractNioChannel<?> channel)
-
Methods inherited from class org.jboss.netty.channel.socket.nio.AbstractNioSelector
cleanUpCancelledKeys, createRegisterTask, increaseCancelledKeys, isIoThread, rebuildSelector, register, registerTask, select, shutdown
-
-
-
-
Field Detail
-
sendBufferPool
protected final SocketSendBufferPool sendBufferPool
-
-
Constructor Detail
-
AbstractNioWorker
AbstractNioWorker(java.util.concurrent.Executor executor)
-
AbstractNioWorker
AbstractNioWorker(java.util.concurrent.Executor executor, ThreadNameDeterminer determiner)
-
-
Method Detail
-
executeInIoThread
public void executeInIoThread(java.lang.Runnable task)
Description copied from interface:Worker
Execute the givenRunnable
in the IO-Thread. This may be now or later once the IO-Thread do some other work.- Specified by:
executeInIoThread
in interfaceWorker
- Parameters:
task
- theRunnable
to execute
-
executeInIoThread
public void executeInIoThread(java.lang.Runnable task, boolean alwaysAsync)
Execute theRunnable
in a IO-Thread- Parameters:
task
- theRunnable
to executealwaysAsync
-true
if theRunnable
should be executed in an async fashion even if the current Thread == IO Thread
-
close
protected void close(java.nio.channels.SelectionKey k)
- Specified by:
close
in classAbstractNioSelector
-
newThreadRenamingRunnable
protected ThreadRenamingRunnable newThreadRenamingRunnable(int id, ThreadNameDeterminer determiner)
- Specified by:
newThreadRenamingRunnable
in classAbstractNioSelector
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classAbstractNioSelector
-
process
protected void process(java.nio.channels.Selector selector) throws java.io.IOException
- Specified by:
process
in classAbstractNioSelector
- Throws:
java.io.IOException
-
writeFromUserCode
void writeFromUserCode(AbstractNioChannel<?> channel)
-
writeFromTaskLoop
void writeFromTaskLoop(AbstractNioChannel<?> ch)
-
writeFromSelectorLoop
void writeFromSelectorLoop(java.nio.channels.SelectionKey k)
-
scheduleWriteIfNecessary
protected abstract boolean scheduleWriteIfNecessary(AbstractNioChannel<?> channel)
-
write0
protected void write0(AbstractNioChannel<?> channel)
-
isIoThread
static boolean isIoThread(AbstractNioChannel<?> channel)
-
setOpWrite
protected void setOpWrite(AbstractNioChannel<?> channel)
-
clearOpWrite
protected void clearOpWrite(AbstractNioChannel<?> channel)
-
close
protected void close(AbstractNioChannel<?> channel, ChannelFuture future)
-
cleanUpWriteBuffer
protected static void cleanUpWriteBuffer(AbstractNioChannel<?> channel)
-
setInterestOps
void setInterestOps(AbstractNioChannel<?> channel, ChannelFuture future, int interestOps)
-
read
protected abstract 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. The channel would previously have registered its interest in read operations.- Parameters:
k
- The selection key which contains the Selector registration information.
-
-