|
||||||||||
| 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)
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 | |
|---|---|
protected java.net.InetAddress |
bind_addr
The interface (NIC) which should be used by this transport |
protected java.lang.String |
channel_name
The name of the group to which this member is connected |
protected boolean |
discard_incompatible_packets
Discard packets with a different version. |
protected Address |
local_addr
The address (host and port) of this member |
protected java.util.Vector<Address> |
members
The members of this group (updated when a member joins or leaves) |
protected ThreadNamingPattern |
thread_naming_pattern
Names the current thread. |
protected TimeScheduler |
timer
|
protected View |
view
|
| Fields inherited from class org.jgroups.stack.Protocol |
|---|
down_prot, log, props, stack, stats, up_prot |
| Constructor Summary | |
|---|---|
protected |
TP()
Creates the TP protocol, and initializes the state variables, does however not start any sockets or threads. |
| Method Summary | |
|---|---|
protected java.util.concurrent.Executor |
createThreadPool(int min_threads,
int max_threads,
long keep_alive_time,
java.lang.String rejection_policy,
java.util.concurrent.BlockingQueue<java.lang.Runnable> queue,
java.lang.String thread_name)
|
java.lang.Object |
down(Event evt)
Caller by the layer above this layer. |
java.util.Map<java.lang.String,java.lang.Object> |
dumpStats()
|
java.lang.String |
getBindAddress()
|
boolean |
getBindToAllInterfaces()
Deprecated. Use isReceiveOnAllInterfaces() instead |
java.lang.String |
getChannelName()
|
long |
getIncomingKeepAliveTime()
|
int |
getIncomingMaxPoolSize()
|
int |
getIncomingMaxQueueSize()
|
long |
getIncomingMessages()
|
int |
getIncomingMinPoolSize()
|
int |
getIncomingPoolSize()
|
int |
getIncomingQueueSize()
|
abstract java.lang.String |
getInfo()
|
Address |
getLocalAddress()
|
int |
getMaxBundleSize()
|
long |
getMaxBundleTimeout()
|
long |
getNumBytesReceived()
|
long |
getNumBytesSent()
|
long |
getNumMessagesReceived()
|
long |
getNumMessagesSent()
|
long |
getOOBKeepAliveTime()
|
int |
getOOBMaxPoolSize()
|
int |
getOOBMaxQueueSize()
|
long |
getOOBMessages()
|
int |
getOOBMinPoolSize()
|
int |
getOOBPoolSize()
|
int |
getOOBQueueSize()
|
java.util.List |
getReceiveInterfaces()
|
java.util.List |
getSendInterfaces()
|
protected void |
handleConfigEvent(java.util.Map<java.lang.String,java.lang.Object> map)
|
protected java.lang.Object |
handleDownEvent(Event evt)
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
boolean |
isDiscardIncompatiblePackets()
|
boolean |
isEnable_unicast_bundling()
|
boolean |
isEnableBundling()
|
boolean |
isLoopback()
|
boolean |
isReceiveOnAllInterfaces()
|
boolean |
isSendOnAllInterfaces()
|
boolean |
isUseIncomingPacketHandler()
|
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 |
setEnable_unicast_bundling(boolean enable_unicast_bundling)
|
void |
setEnableBundling(boolean flag)
|
void |
setIncomingKeepAliveTime(long time)
|
void |
setIncomingMaxPoolSize(int size)
|
void |
setIncomingMinPoolSize(int size)
|
void |
setLoopback(boolean b)
|
void |
setMaxBundleSize(int size)
|
void |
setMaxBundleTimeout(long timeout)
|
void |
setOOBKeepAliveTime(long time)
|
void |
setOOBMaxPoolSize(int size)
|
void |
setOOBMinPoolSize(int size)
|
boolean |
setProperties(java.util.Properties props)
Setup the Protocol instance according to the configuration string |
protected void |
setThreadNames()
|
void |
start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads |
void |
stop()
This method is called on a Channel.disconnect(). |
java.lang.String |
toString()
debug only |
protected void |
unsetThreadNames()
|
java.lang.Object |
up(Event evt)
handle the UP event. |
| Methods inherited from class org.jgroups.stack.Protocol |
|---|
destroy, downThreadEnabled, enableStats, getDownProtocol, getName, getProperties, getProtocolStack, getUpProtocol, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Address local_addr
protected java.lang.String channel_name
protected java.net.InetAddress bind_addr
protected final java.util.Vector<Address> members
protected View view
protected boolean discard_incompatible_packets
protected ThreadNamingPattern thread_naming_pattern
protected TimeScheduler timer
| Constructor Detail |
|---|
protected TP()
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic void resetStats()
resetStats in class Protocolpublic 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.UnknownHostExceptionpublic 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 boolean isEnable_unicast_bundling()
public void setEnable_unicast_bundling(boolean enable_unicast_bundling)
public int getMaxBundleSize()
public void setMaxBundleSize(int size)
public long getMaxBundleTimeout()
public void setMaxBundleTimeout(long timeout)
public Address getLocalAddress()
public java.lang.String getChannelName()
public boolean isLoopback()
public void setLoopback(boolean b)
public boolean isUseIncomingPacketHandler()
public int getOOBMinPoolSize()
public void setOOBMinPoolSize(int size)
public int getOOBMaxPoolSize()
public void setOOBMaxPoolSize(int size)
public int getOOBPoolSize()
public long getOOBKeepAliveTime()
public void setOOBKeepAliveTime(long time)
public long getOOBMessages()
public int getOOBQueueSize()
public int getOOBMaxQueueSize()
public int getIncomingMinPoolSize()
public void setIncomingMinPoolSize(int size)
public int getIncomingMaxPoolSize()
public void setIncomingMaxPoolSize(int size)
public int getIncomingPoolSize()
public long getIncomingKeepAliveTime()
public void setIncomingKeepAliveTime(long time)
public long getIncomingMessages()
public int getIncomingQueueSize()
public int getIncomingMaxQueueSize()
public java.util.Map<java.lang.String,java.lang.Object> 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.Exceptionpublic 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 init()
throws java.lang.Exception
Protocol
init in class Protocoljava.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exception
public void start()
throws java.lang.Exception
start in class Protocoljava.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()
ProtocolChannel.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 Protocolpublic boolean setProperties(java.util.Properties props)
setProperties in class Protocolpublic java.lang.Object up(Event evt)
up in class Protocolevt - - the event being send from the stackpublic java.lang.Object 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 java.lang.Object handleDownEvent(Event evt)
protected void setThreadNames()
protected void unsetThreadNames()
protected void handleConfigEvent(java.util.Map<java.lang.String,java.lang.Object> map)
protected java.util.concurrent.Executor createThreadPool(int min_threads,
int max_threads,
long keep_alive_time,
java.lang.String rejection_policy,
java.util.concurrent.BlockingQueue<java.lang.Runnable> queue,
java.lang.String thread_name)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||