Apache Tomcat 6.0.39

org.apache.catalina.tribes.transport.bio
Class BioReplicationTask

java.lang.Object
  extended by org.apache.catalina.tribes.transport.AbstractRxTask
      extended by org.apache.catalina.tribes.transport.bio.BioReplicationTask
All Implemented Interfaces:
java.lang.Runnable

public class BioReplicationTask
extends AbstractRxTask

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.

Version:
$Id: BioReplicationTask.java 1561778 2014-01-27 18:37:12Z markt $
Author:
Filip Hanik

Field Summary
protected static Log log
           
protected  ObjectReader reader
           
protected  java.net.Socket socket
           
 
Fields inherited from class org.apache.catalina.tribes.transport.AbstractRxTask
OPTION_DIRECT_BUFFER, useBufferPool
 
Constructor Summary
BioReplicationTask(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.AbstractRxTask
getCallback, getOptions, getTaskPool, getUseBufferPool, isDoRun, setCallback, setDoRun, setOptions, setTaskPool, setUseBufferPool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Log log

socket

protected java.net.Socket socket

reader

protected ObjectReader reader
Constructor Detail

BioReplicationTask

public BioReplicationTask(ListenCallback callback)
Method Detail

run

public void run()

serviceSocket

public void serviceSocket(java.net.Socket socket,
                          ObjectReader reader)

execute

protected void execute(ObjectReader reader)
                throws java.lang.Exception
Throws:
java.lang.Exception

drainSocket

protected void drainSocket()
                    throws java.lang.Exception
The actual code which drains the channel associated with the given key. This method assumes the key has been modified prior to invocation to turn off selection interest in OP_READ. When this method completes it re-enables OP_READ and calls wakeup() on the selector so the selector will resume watching this channel.

Throws:
java.lang.Exception

sendAck

protected void sendAck(byte[] command)
send a reply-acknowledgement (6,2,3)


close

public void close()
Overrides:
close in class AbstractRxTask

Apache Tomcat 6.0.39

Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.