org.apache.catalina.tribes.transport.nio

Class NioReceiver

public class NioReceiver extends ReceiverBase implements Runnable, ChannelReceiver, ListenCallback

Version: $Revision: 538977 $ $Date: 2007-05-17 17:43:49 +0200 (Thu, 17 May 2007) $

Author: Filip Hanik

Field Summary
protected LinkedListevents
protected longlastCheck
protected static Loglog
protected StringManagersm
The string manager for this package.
Constructor Summary
NioReceiver()
Method Summary
voidaddEvent(Runnable event)
protected voidbind()
static voidcancelledKey(SelectionKey key)
AbstractRxTaskcreateRxTask()
voidevents()
StringgetInfo()
Return descriptive information about this implementation and the corresponding version number, in the format <description>/<version>.
protected voidlisten()
get data from channel and store in byte array send it to cluster
protected voidreadDataFromSocket(SelectionKey key)
Sample data handler method for a channel with data ready to read.
protected voidregisterChannel(Selector selector, SelectableChannel channel, int ops, Object attach)
Register the given channel with the given selector for the given operations of interest
voidrun()
Start thread and listen
protected voidsocketTimeouts()
voidstart()
start cluster receiver
voidstop()
protected voidstopListening()
Close Selector.

Field Detail

events

protected LinkedList events

lastCheck

protected long lastCheck

log

protected static Log log

sm

protected StringManager sm
The string manager for this package.

Constructor Detail

NioReceiver

public NioReceiver()

Method Detail

addEvent

public void addEvent(Runnable event)

bind

protected void bind()

cancelledKey

public static void cancelledKey(SelectionKey key)

createRxTask

public AbstractRxTask createRxTask()

events

public void events()

getInfo

public String getInfo()
Return descriptive information about this implementation and the corresponding version number, in the format <description>/<version>.

listen

protected void listen()
get data from channel and store in byte array send it to cluster

Throws: IOException java.nio.channels.ClosedChannelException

readDataFromSocket

protected void readDataFromSocket(SelectionKey key)
Sample data handler method for a channel with data ready to read.

Parameters: key A SelectionKey object associated with a channel determined by the selector to be ready for reading. If the channel returns an EOF condition, it is closed here, which automatically invalidates the associated key. The selector will then de-register the channel on the next select call.

registerChannel

protected void registerChannel(Selector selector, SelectableChannel channel, int ops, Object attach)
Register the given channel with the given selector for the given operations of interest

run

public void run()
Start thread and listen

socketTimeouts

protected void socketTimeouts()

start

public void start()
start cluster receiver

Throws: Exception

See Also: org.apache.catalina.tribes.ClusterReceiver#start()

stop

public void stop()

stopListening

protected void stopListening()
Close Selector.

See Also: org.apache.catalina.tribes.transport.ClusterReceiverBase#stopListening()

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