|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.apache.catalina.tribes.transport.WorkerThread
org.apache.catalina.tribes.transport.bio.BioReplicationThread
public class BioReplicationThread
A worker thread class which can drain channels and echo-back the input. Each instance is constructed with a reference to the owning thread pool object. When started, the thread loops forever waiting to be awakened to service the channel associated with a SelectionKey object. The worker is tasked by calling its serviceChannel() method with a SelectionKey object. The serviceChannel() method stores the key reference in the thread object then calls notify() to wake it up. When the channel has been drained, the worker thread returns itself to its parent pool.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected static Log |
log
|
protected ObjectReader |
reader
|
protected java.net.Socket |
socket
|
Fields inherited from class org.apache.catalina.tribes.transport.WorkerThread |
---|
OPTION_DIRECT_BUFFER, useBufferPool |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
BioReplicationThread(ListenCallback callback)
|
Method Summary | |
---|---|
void |
close()
|
protected void |
drainSocket()
The actual code which drains the channel associated with the given key. |
protected void |
execute(ObjectReader reader)
|
void |
run()
|
protected void |
sendAck(byte[] command)
send a reply-acknowledgement (6,2,3) |
void |
serviceSocket(java.net.Socket socket,
ObjectReader reader)
|
Methods inherited from class org.apache.catalina.tribes.transport.WorkerThread |
---|
getCallback, getOptions, getPool, getUseBufferPool, isDoRun, setCallback, setDoRun, setOptions, setPool, setUseBufferPool |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static Log log
protected java.net.Socket socket
protected ObjectReader reader
Constructor Detail |
---|
public BioReplicationThread(ListenCallback callback)
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void serviceSocket(java.net.Socket socket, ObjectReader reader)
protected void execute(ObjectReader reader) throws java.lang.Exception
java.lang.Exception
protected void drainSocket() throws java.lang.Exception
java.lang.Exception
protected void sendAck(byte[] command)
key
- channel
- public void close()
close
in class WorkerThread
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |