Class NioDatagramWorker
- java.lang.Object
-
- org.jboss.netty.channel.socket.nio.AbstractNioSelector
-
- org.jboss.netty.channel.socket.nio.AbstractNioWorker
-
- org.jboss.netty.channel.socket.nio.NioDatagramWorker
-
- All Implemented Interfaces:
java.lang.Runnable,NioSelector,Worker
public class NioDatagramWorker extends AbstractNioWorker
A class responsible for registering channels withSelector. It also implements theSelectorloop.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classNioDatagramWorker.ChannelRegistionTaskRegisterTask is a task responsible for registering a channel with a selector.
-
Field Summary
Fields Modifier and Type Field Description private SocketReceiveBufferAllocatorbufferAllocator-
Fields inherited from class org.jboss.netty.channel.socket.nio.AbstractNioWorker
sendBufferPool
-
Fields inherited from class org.jboss.netty.channel.socket.nio.AbstractNioSelector
logger, selector, startupLatch, thread, wakenUp
-
-
Constructor Summary
Constructors Constructor Description NioDatagramWorker(java.util.concurrent.Executor executor)Sole constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.RunnablecreateRegisterTask(Channel channel, ChannelFuture future)(package private) static voiddisconnect(NioDatagramChannel channel, ChannelFuture future)protected booleanread(java.nio.channels.SelectionKey key)Read is called when a Selector has been notified that the underlying channel was something to be read.voidrun()protected booleanscheduleWriteIfNecessary(AbstractNioChannel<?> channel)protected voidwrite0(AbstractNioChannel<?> channel)voidwriteFromUserCode(AbstractNioChannel<?> channel)-
Methods inherited from class org.jboss.netty.channel.socket.nio.AbstractNioWorker
cleanUpWriteBuffer, clearOpWrite, close, close, executeInIoThread, executeInIoThread, isIoThread, newThreadRenamingRunnable, process, setInterestOps, setOpWrite, writeFromSelectorLoop, writeFromTaskLoop
-
Methods inherited from class org.jboss.netty.channel.socket.nio.AbstractNioSelector
cleanUpCancelledKeys, increaseCancelledKeys, isIoThread, rebuildSelector, register, registerTask, select, shutdown
-
-
-
-
Field Detail
-
bufferAllocator
private final SocketReceiveBufferAllocator bufferAllocator
-
-
Constructor Detail
-
NioDatagramWorker
NioDatagramWorker(java.util.concurrent.Executor executor)
Sole constructor.- Parameters:
executor- theExecutorused to executeRunnables such asNioDatagramWorker.ChannelRegistionTask
-
-
Method Detail
-
read
protected boolean read(java.nio.channels.SelectionKey key)
Description copied from class:AbstractNioWorkerRead 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.- Specified by:
readin classAbstractNioWorker- Parameters:
key- The selection key which contains the Selector registration information.
-
scheduleWriteIfNecessary
protected boolean scheduleWriteIfNecessary(AbstractNioChannel<?> channel)
- Specified by:
scheduleWriteIfNecessaryin classAbstractNioWorker
-
disconnect
static void disconnect(NioDatagramChannel channel, ChannelFuture future)
-
createRegisterTask
protected java.lang.Runnable createRegisterTask(Channel channel, ChannelFuture future)
- Specified by:
createRegisterTaskin classAbstractNioSelector
-
writeFromUserCode
public void writeFromUserCode(AbstractNioChannel<?> channel)
- Overrides:
writeFromUserCodein classAbstractNioWorker
-
write0
protected void write0(AbstractNioChannel<?> channel)
- Overrides:
write0in classAbstractNioWorker
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classAbstractNioWorker
-
-