org.jgroups.protocols

Class TP

public abstract class TP extends Protocol

Generic transport - specific implementations should extend this abstract class. Features which are provided to the subclasses include A subclass has to override The create() or start() method has to create a local address.
The (Address, Address, byte[], int, int) method must be called by subclasses when a unicast or multicast message has been received.

Version: $Id: TP.java,v 1.53.2.1 2006/05/16 04:20:38 belaban Exp $

Author: Bela Ban

Constructor Summary
protected TP()
Creates the TP protocol, and initializes the state variables, does however not start any sockets or threads.
Method Summary
voiddown(Event evt)
Caller by the layer above this layer.
MapdumpStats()
StringgetBindAddress()
booleangetBindToAllInterfaces()
StringgetChannelName()
intgetIncomingQueueSize()
abstract StringgetInfo()
AddressgetLocalAddress()
intgetMaxBundleSize()
longgetMaxBundleTimeout()
longgetNumBytesReceived()
longgetNumBytesSent()
longgetNumMessagesReceived()
longgetNumMessagesSent()
intgetOutgoingQueueMaxSize()
intgetOutgoingQueueSize()
ListgetReceiveInterfaces()
ListgetSendInterfaces()
protected voidhandleConfigEvent(HashMap map)
protected voidhandleDownEvent(Event evt)
booleanisDiscardIncompatiblePackets()
booleanisEnableBundling()
booleanisLoopback()
booleanisReceiveOnAllInterfaces()
booleanisSendOnAllInterfaces()
booleanisUseIncomingPacketHandler()
booleanisUseOutgoingPacketHandler()
abstract voidpostUnmarshalling(Message msg, Address dest, Address src, boolean multicast)
abstract voidpostUnmarshallingList(Message msg, Address dest, boolean multicast)
protected voidreceive(Address dest, Address sender, byte[] data, int offset, int length)
Subclasses must call this method when a unicast or multicast message has been received.
voidresetStats()
abstract voidsendToAllMembers(byte[] data, int offset, int length)
Send to all members in the group.
abstract voidsendToSingleMember(Address dest, byte[] data, int offset, int length)
Send to all members in the group.
voidsetBindAddress(String bind_addr)
voidsetBindToAllInterfaces(boolean flag)
voidsetDiscardIncompatiblePackets(boolean flag)
voidsetEnableBundling(boolean flag)
voidsetLoopback(boolean b)
voidsetMaxBundleSize(int size)
voidsetMaxBundleTimeout(long timeout)
voidsetOutgoingQueueMaxSize(int new_size)
booleansetProperties(Properties props)
Setup the Protocol instance according to the configuration string
voidstart()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads
voidstartUpHandler()
This prevents the up-handler thread to be created, which essentially is superfluous: messages are received from the network rather than from a layer below.
voidstop()
StringtoString()
debug only
voidup(Event evt)
handle the UP event.

Constructor Detail

TP

protected TP()
Creates the TP protocol, and initializes the state variables, does however not start any sockets or threads.

Method Detail

down

public void down(Event evt)
Caller by the layer above this layer. Usually we just put this Message into the send queue and let one or more worker threads handle it. A worker thread then removes the Message from the send queue, performs a conversion and adds the modified Message to the send queue of the layer below it, by calling down()).

dumpStats

public Map dumpStats()

getBindAddress

public String getBindAddress()

getBindToAllInterfaces

public boolean getBindToAllInterfaces()

Deprecated: Use isReceiveOnAllInterfaces instead

getChannelName

public String getChannelName()

getIncomingQueueSize

public int getIncomingQueueSize()

getInfo

public abstract String getInfo()

getLocalAddress

public Address getLocalAddress()

getMaxBundleSize

public int getMaxBundleSize()

getMaxBundleTimeout

public long getMaxBundleTimeout()

getNumBytesReceived

public long getNumBytesReceived()

getNumBytesSent

public long getNumBytesSent()

getNumMessagesReceived

public long getNumMessagesReceived()

getNumMessagesSent

public long getNumMessagesSent()

getOutgoingQueueMaxSize

public int getOutgoingQueueMaxSize()

getOutgoingQueueSize

public int getOutgoingQueueSize()

getReceiveInterfaces

public List getReceiveInterfaces()

getSendInterfaces

public List getSendInterfaces()

handleConfigEvent

protected void handleConfigEvent(HashMap map)

handleDownEvent

protected void handleDownEvent(Event evt)

isDiscardIncompatiblePackets

public boolean isDiscardIncompatiblePackets()

isEnableBundling

public boolean isEnableBundling()

isLoopback

public boolean isLoopback()

isReceiveOnAllInterfaces

public boolean isReceiveOnAllInterfaces()

isSendOnAllInterfaces

public boolean isSendOnAllInterfaces()

isUseIncomingPacketHandler

public boolean isUseIncomingPacketHandler()

isUseOutgoingPacketHandler

public boolean isUseOutgoingPacketHandler()

postUnmarshalling

public abstract void postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)

postUnmarshallingList

public abstract void postUnmarshallingList(Message msg, Address dest, boolean multicast)

receive

protected final void receive(Address dest, Address sender, byte[] data, int offset, int length)
Subclasses must call this method when a unicast or multicast message has been received. Declared final so subclasses cannot override this method.

Parameters: dest sender data offset length

resetStats

public void resetStats()

sendToAllMembers

public abstract void sendToAllMembers(byte[] data, int offset, int length)
Send to all members in the group. UDP would use an IP multicast message, whereas TCP would send N messages, one for each member

Parameters: data The data to be sent. This is not a copy, so don't modify it offset length

Throws: Exception

sendToSingleMember

public abstract void sendToSingleMember(Address dest, byte[] data, int offset, int length)
Send to all members in the group. UDP would use an IP multicast message, whereas TCP would send N messages, one for each member

Parameters: dest Must be a non-null unicast address data The data to be sent. This is not a copy, so don't modify it offset length

Throws: Exception

setBindAddress

public void setBindAddress(String bind_addr)

setBindToAllInterfaces

public void setBindToAllInterfaces(boolean flag)

setDiscardIncompatiblePackets

public void setDiscardIncompatiblePackets(boolean flag)

setEnableBundling

public void setEnableBundling(boolean flag)

setLoopback

public void setLoopback(boolean b)

setMaxBundleSize

public void setMaxBundleSize(int size)

setMaxBundleTimeout

public void setMaxBundleTimeout(long timeout)

setOutgoingQueueMaxSize

public void setOutgoingQueueMaxSize(int new_size)

setProperties

public boolean setProperties(Properties props)
Setup the Protocol instance according to the configuration string

Returns: true if no other properties are left. false if the properties still have data in them, ie , properties are left over and not handled by the protocol stack

start

public void start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads

startUpHandler

public void startUpHandler()
This prevents the up-handler thread to be created, which essentially is superfluous: messages are received from the network rather than from a layer below. DON'T REMOVE !

stop

public void stop()

toString

public String toString()
debug only

up

public void up(Event evt)
handle the UP event.

Parameters: evt - the event being send from the stack

Copyright ? 1998-2005 Bela Ban. All Rights Reserved.