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 C
channel
private boolean
done
private java.util.Queue<java.lang.Runnable>
eventQueue
protected java.lang.Thread
thread
If this worker has been started thread will be a reference to the thread used when starting.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractOioWorker(C channel)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) static void
close(AbstractOioChannel channel, ChannelFuture future)
private static void
close(AbstractOioChannel channel, ChannelFuture future, boolean iothread)
void
executeInIoThread(java.lang.Runnable task)
Execute the givenRunnable
in the IO-Thread.(package private) static boolean
isIoThread(AbstractOioChannel channel)
(package private) abstract boolean
process()
Process the incoming messages and also is responsible for callChannels.fireMessageReceived(Channel, Object)
once a message was processed without errors.private void
processEventQueue()
void
run()
(package private) static void
setInterestOps(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:
run
in interfacejava.lang.Runnable
-
isIoThread
static boolean isIoThread(AbstractOioChannel channel)
-
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
-
processEventQueue
private void processEventQueue()
-
process
abstract boolean process() throws java.io.IOException
Process the incoming messages and also is responsible for callChannels.fireMessageReceived(Channel, Object)
once a message was processed without errors.- Returns:
- continue returns
true
as 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)
-
-