Class AbstractOioWorker<C extends AbstractOioChannel>
- java.lang.Object
-
- org.jboss.netty.channel.socket.oio.AbstractOioWorker<C>
-
- Type Parameters:
C-AbstractOioChannel
- All Implemented Interfaces:
java.lang.Runnable,Worker
- Direct Known Subclasses:
OioDatagramWorker,OioWorker
abstract class AbstractOioWorker<C extends AbstractOioChannel> extends java.lang.Object implements Worker
Abstract base class for Oio-Worker implementations
-
-
Field Summary
Fields Modifier and Type Field Description protected Cchannelprivate booleandoneprivate java.util.Queue<java.lang.Runnable>eventQueueprotected java.lang.ThreadthreadIf this worker has been started thread will be a reference to the thread used when starting.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractOioWorker(C channel)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) static voidclose(AbstractOioChannel channel, ChannelFuture future)private static voidclose(AbstractOioChannel channel, ChannelFuture future, boolean iothread)voidexecuteInIoThread(java.lang.Runnable task)Execute the givenRunnablein the IO-Thread.(package private) static booleanisIoThread(AbstractOioChannel channel)(package private) abstract booleanprocess()Process the incoming messages and also is responsible for callChannels.fireMessageReceived(Channel, Object)once a message was processed without errors.private voidprocessEventQueue()voidrun()(package private) static voidsetInterestOps(AbstractOioChannel channel, ChannelFuture future, int interestOps)
-
-
-
Field Detail
-
eventQueue
private final java.util.Queue<java.lang.Runnable> eventQueue
-
channel
protected final C extends AbstractOioChannel channel
-
thread
protected volatile 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.
-
done
private volatile boolean done
-
-
Constructor Detail
-
AbstractOioWorker
protected AbstractOioWorker(C channel)
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
isIoThread
static boolean isIoThread(AbstractOioChannel channel)
-
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
-
processEventQueue
private void processEventQueue()
-
process
abstract boolean process() throws java.io.IOExceptionProcess the incoming messages and also is responsible for callChannels.fireMessageReceived(Channel, Object)once a message was processed without errors.- Returns:
- continue returns
trueas long as this worker should continue to try processing incoming messages - Throws:
java.io.IOException
-
setInterestOps
static void setInterestOps(AbstractOioChannel channel, ChannelFuture future, int interestOps)
-
close
static void close(AbstractOioChannel channel, ChannelFuture future)
-
close
private static void close(AbstractOioChannel channel, ChannelFuture future, boolean iothread)
-
-