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 SocketSendBufferPoolsendBufferPool-
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 voidcleanUpWriteBuffer(AbstractNioChannel<?> channel)protected voidclearOpWrite(AbstractNioChannel<?> channel)protected voidclose(java.nio.channels.SelectionKey k)protected voidclose(AbstractNioChannel<?> channel, ChannelFuture future)voidexecuteInIoThread(java.lang.Runnable task)Execute the givenRunnablein the IO-Thread.voidexecuteInIoThread(java.lang.Runnable task, boolean alwaysAsync)Execute theRunnablein a IO-Thread(package private) static booleanisIoThread(AbstractNioChannel<?> channel)protected ThreadRenamingRunnablenewThreadRenamingRunnable(int id, ThreadNameDeterminer determiner)protected voidprocess(java.nio.channels.Selector selector)protected abstract booleanread(java.nio.channels.SelectionKey k)Read is called when a Selector has been notified that the underlying channel was something to be read.voidrun()protected abstract booleanscheduleWriteIfNecessary(AbstractNioChannel<?> channel)(package private) voidsetInterestOps(AbstractNioChannel<?> channel, ChannelFuture future, int interestOps)protected voidsetOpWrite(AbstractNioChannel<?> channel)protected voidwrite0(AbstractNioChannel<?> channel)(package private) voidwriteFromSelectorLoop(java.nio.channels.SelectionKey k)(package private) voidwriteFromTaskLoop(AbstractNioChannel<?> ch)(package private) voidwriteFromUserCode(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:WorkerExecute the givenRunnablein the IO-Thread. This may be now or later once the IO-Thread do some other work.- Specified by:
executeInIoThreadin interfaceWorker- Parameters:
task- theRunnableto execute
-
executeInIoThread
public void executeInIoThread(java.lang.Runnable task, boolean alwaysAsync)Execute theRunnablein a IO-Thread- Parameters:
task- theRunnableto executealwaysAsync-trueif theRunnableshould be executed in an async fashion even if the current Thread == IO Thread
-
close
protected void close(java.nio.channels.SelectionKey k)
- Specified by:
closein classAbstractNioSelector
-
newThreadRenamingRunnable
protected ThreadRenamingRunnable newThreadRenamingRunnable(int id, ThreadNameDeterminer determiner)
- Specified by:
newThreadRenamingRunnablein classAbstractNioSelector
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classAbstractNioSelector
-
process
protected void process(java.nio.channels.Selector selector) throws java.io.IOException- Specified by:
processin 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.
-
-