Class NioDatagramWorker
java.lang.Object
org.jboss.netty.channel.socket.nio.NioDatagramWorker
- All Implemented Interfaces:
Runnable,NioSelector,Worker
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final InternalLoggerInternal Netty logger.protected SelectorThe NIOSelector.protected final org.jboss.netty.channel.socket.nio.SocketSendBufferPoolprotected ThreadIf 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 final AtomicBooleanBoolean that controls determines if a blocked Selector.select should break out of its selection process. -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanprotected static voidcleanUpWriteBuffer(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) protected voidclearOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) protected voidprotected voidclose(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel, ChannelFuture future) protected RunnablecreateRegisterTask(Channel channel, ChannelFuture future) voidexecuteInIoThread(Runnable task) Execute the givenRunnablein the IO-Thread.voidexecuteInIoThread(Runnable task, boolean alwaysAsync) Execute theRunnablein a IO-Threadprotected final voidprotected final booleanprotected ThreadRenamingRunnablenewThreadRenamingRunnable(int id, ThreadNameDeterminer determiner) protected voidprotected booleanread(SelectionKey key) Read is called when a Selector has been notified that the underlying channel was something to be read.voidvoidregister(Channel channel, ChannelFuture future) protected final voidregisterTask(Runnable task) voidrun()protected booleanscheduleWriteIfNecessary(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) protected intprotected voidsetOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) voidshutdown()protected voidwrite0(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) voidwriteFromUserCode(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel)
-
Field Details
-
sendBufferPool
protected final org.jboss.netty.channel.socket.nio.SocketSendBufferPool sendBufferPool -
logger
Internal Netty logger. -
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. -
selector
The NIOSelector. -
wakenUp
Boolean that controls determines if a blocked Selector.select should break out of its selection process. In our case we use a timeone for the select method and the select method will block for that time unless waken up.
-
-
Method Details
-
read
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:
key- The selection key which contains the Selector registration information.
-
scheduleWriteIfNecessary
protected boolean scheduleWriteIfNecessary(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) -
createRegisterTask
-
writeFromUserCode
public void writeFromUserCode(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) -
write0
protected void write0(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) -
run
public void run() -
executeInIoThread
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
Execute theRunnablein a IO-Thread -
close
-
newThreadRenamingRunnable
-
process
- Throws:
IOException
-
setOpWrite
protected void setOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) -
clearOpWrite
protected void clearOpWrite(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) -
close
protected void close(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel, ChannelFuture future) -
cleanUpWriteBuffer
protected static void cleanUpWriteBuffer(org.jboss.netty.channel.socket.nio.AbstractNioChannel<?> channel) -
register
- Specified by:
registerin interfaceNioSelector
-
registerTask
-
isIoThread
protected final boolean isIoThread() -
rebuildSelector
public void rebuildSelector()Description copied from interface:NioSelector- Specified by:
rebuildSelectorin interfaceNioSelector
-
increaseCancelledKeys
protected final void increaseCancelledKeys() -
cleanUpCancelledKeys
- Throws:
IOException
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceNioSelector
-
select
- Throws:
IOException
-