|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgroups.stack.Protocol
org.jgroups.protocols.TP
public abstract class TP
Generic transport - specific implementations should extend this abstract class. Features which are provided to the subclasses include
sendToAllMembers(byte[], int, int)
sendToSingleMember(org.jgroups.Address, byte[], int, int)
Protocol.init()
start()
: subclasses must call super.start() after they initialize themselves
(e.g., created their sockets).
stop()
: subclasses must call super.stop() after they deinitialized themselves
Protocol.destroy()
receive(Address, Address, byte[], int, int)
method must
be called by subclasses when a unicast or multicast message has been received.
Field Summary |
---|
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, trace, up_handler, up_prot, up_queue, up_thread, up_thread_prio, warn |
Constructor Summary | |
---|---|
protected |
TP()
Creates the TP protocol, and initializes the state variables, does however not start any sockets or threads. |
Method Summary | |
---|---|
void |
down(Event evt)
Caller by the layer above this layer. |
java.util.Map |
dumpStats()
|
java.lang.String |
getBindAddress()
|
boolean |
getBindToAllInterfaces()
Deprecated. Use isReceiveOnAllInterfaces() instead |
java.lang.String |
getChannelName()
|
int |
getIncomingQueueSize()
|
abstract java.lang.String |
getInfo()
|
Address |
getLocalAddress()
|
int |
getMaxBundleSize()
|
long |
getMaxBundleTimeout()
|
long |
getNumBytesReceived()
|
long |
getNumBytesSent()
|
long |
getNumMessagesReceived()
|
long |
getNumMessagesSent()
|
int |
getOutgoingQueueMaxSize()
|
int |
getOutgoingQueueSize()
|
java.util.List |
getReceiveInterfaces()
|
java.util.List |
getSendInterfaces()
|
protected void |
handleConfigEvent(java.util.HashMap map)
|
protected void |
handleDownEvent(Event evt)
|
boolean |
isDiscardIncompatiblePackets()
|
boolean |
isEnableBundling()
|
boolean |
isLoopback()
|
boolean |
isReceiveOnAllInterfaces()
|
boolean |
isSendOnAllInterfaces()
|
boolean |
isUseIncomingPacketHandler()
|
boolean |
isUseOutgoingPacketHandler()
|
abstract void |
postUnmarshalling(Message msg,
Address dest,
Address src,
boolean multicast)
|
abstract void |
postUnmarshallingList(Message msg,
Address dest,
boolean multicast)
|
protected 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. |
void |
resetStats()
|
abstract void |
sendToAllMembers(byte[] data,
int offset,
int length)
Send to all members in the group. |
abstract void |
sendToSingleMember(Address dest,
byte[] data,
int offset,
int length)
Send to all members in the group. |
void |
setBindAddress(java.lang.String bind_addr)
|
void |
setBindToAllInterfaces(boolean flag)
|
void |
setDiscardIncompatiblePackets(boolean flag)
|
void |
setEnableBundling(boolean flag)
|
void |
setLoopback(boolean b)
|
void |
setMaxBundleSize(int size)
|
void |
setMaxBundleTimeout(long timeout)
|
void |
setOutgoingQueueMaxSize(int new_size)
|
boolean |
setProperties(java.util.Properties props)
Setup the Protocol instance according to the configuration string |
void |
start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads |
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. |
void |
stop()
This method is called on a Channel.disconnect() . |
java.lang.String |
toString()
debug only |
void |
up(Event evt)
handle the UP event. |
Methods inherited from class org.jgroups.stack.Protocol |
---|
destroy, downThreadEnabled, enableStats, getDownProtocol, getDownQueue, getName, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, startDownHandler, statsEnabled, stopInternal, upThreadEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected TP()
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public void resetStats()
resetStats
in class Protocol
public long getNumMessagesSent()
public long getNumMessagesReceived()
public long getNumBytesSent()
public long getNumBytesReceived()
public java.lang.String getBindAddress()
public void setBindAddress(java.lang.String bind_addr) throws java.net.UnknownHostException
java.net.UnknownHostException
public boolean getBindToAllInterfaces()
isReceiveOnAllInterfaces()
instead
public void setBindToAllInterfaces(boolean flag)
public boolean isReceiveOnAllInterfaces()
public java.util.List getReceiveInterfaces()
public boolean isSendOnAllInterfaces()
public java.util.List getSendInterfaces()
public boolean isDiscardIncompatiblePackets()
public void setDiscardIncompatiblePackets(boolean flag)
public boolean isEnableBundling()
public void setEnableBundling(boolean flag)
public int getMaxBundleSize()
public void setMaxBundleSize(int size)
public long getMaxBundleTimeout()
public void setMaxBundleTimeout(long timeout)
public int getOutgoingQueueSize()
public int getIncomingQueueSize()
public Address getLocalAddress()
public java.lang.String getChannelName()
public boolean isLoopback()
public void setLoopback(boolean b)
public boolean isUseIncomingPacketHandler()
public boolean isUseOutgoingPacketHandler()
public int getOutgoingQueueMaxSize()
public void setOutgoingQueueMaxSize(int new_size)
public java.util.Map dumpStats()
dumpStats
in class Protocol
public abstract void sendToAllMembers(byte[] data, int offset, int length) throws java.lang.Exception
data
- The data to be sent. This is not a copy, so don't modify itoffset
- length
-
java.lang.Exception
public abstract void sendToSingleMember(Address dest, byte[] data, int offset, int length) throws java.lang.Exception
dest
- Must be a non-null unicast addressdata
- The data to be sent. This is not a copy, so don't modify itoffset
- length
-
java.lang.Exception
public abstract java.lang.String getInfo()
public abstract void postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)
public abstract void postUnmarshallingList(Message msg, Address dest, boolean multicast)
public void start() throws java.lang.Exception
start
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushed
stop
in class Protocol
public boolean setProperties(java.util.Properties props)
setProperties
in class Protocol
public void startUpHandler()
startUpHandler
in class Protocol
public void up(Event evt)
up
in class Protocol
evt
- - the event being send from the stackpublic void down(Event evt)
down
in class Protocol
protected final void receive(Address dest, Address sender, byte[] data, int offset, int length)
dest
- sender
- data
- offset
- length
- protected void handleDownEvent(Event evt)
protected void handleConfigEvent(java.util.HashMap map)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |