org.apache.catalina.tribes.transport.bio

Class BioReplicationTask

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: $Revision: 500684 $, $Date: 2007-01-28 00:27:18 +0100 (Sun, 28 Jan 2007) $

Author: Filip Hanik

Field Summary
protected static Loglog
protected ObjectReaderreader
protected Socketsocket
Constructor Summary
BioReplicationTask(ListenCallback callback)
Method Summary
voidclose()
protected voiddrainSocket()
The actual code which drains the channel associated with the given key.
protected voidexecute(ObjectReader reader)
voidrun()
protected voidsendAck(byte[] command)
send a reply-acknowledgement (6,2,3)
voidserviceSocket(Socket socket, ObjectReader reader)

Field Detail

log

protected static Log log

reader

protected ObjectReader reader

socket

protected Socket socket

Constructor Detail

BioReplicationTask

public BioReplicationTask(ListenCallback callback)

Method Detail

close

public void close()

drainSocket

protected void drainSocket()
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.

execute

protected void execute(ObjectReader reader)

run

public void run()

sendAck

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

Parameters: key channel

serviceSocket

public void serviceSocket(Socket socket, ObjectReader reader)
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.