org.jgroups.protocols
Class UDP
- Runnable
public class UDP
implements Runnable
IP multicast transport based on UDP. Messages to the group (msg.dest == null) will
be multicast (to all group members), whereas point-to-point messages
(msg.dest != null) will be unicast to a single member. Uses a multicast and
a unicast socket.
The following properties are read by the UDP protocol:
- param mcast_addr - the multicast address to use; default is 228.8.8.8.
- param mcast_port - (int) the port that the multicast is sent on; default is 7600
- param ip_mcast - (boolean) flag whether to use IP multicast; default is true.
- param ip_ttl - the default time-to-live for multicast packets sent out on this
socket; default is 32.
- param use_packet_handler - boolean, defaults to false.
If set, the mcast and ucast receiver threads just put
the datagram's payload (a byte buffer) into a queue, from where a separate thread
will dequeue and handle them (unmarshal and pass up). This frees the receiver
threads from having to do message unmarshalling; this time can now be spent
receiving packets. If you have lots of retransmissions because of network
input buffer overflow, consider setting this property to true.
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 |
UDP() - Creates the UDP protocol, and initializes the
state variables, does however not start any sockets or threads.
|
String | getInfo()
|
String | getName()
|
protected void | handleConfigEvent(HashMap map)
|
void | postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)
|
void | postUnmarshallingList(Message msg, Address dest, boolean multicast)
|
void | run()
|
void | sendToAllMembers(byte[] data, int offset, int length)
|
void | sendToSingleMember(Address dest, byte[] data, int offset, int length)
|
boolean | setProperties(Properties props) - Setup the Protocol instance acording to the configuration string.
|
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() .
|
down , dumpStats , getBindAddress , getBindToAllInterfaces , getChannelName , getIncomingQueueSize , getInfo , getLocalAddress , getMaxBundleSize , getMaxBundleTimeout , getNumBytesReceived , getNumBytesSent , getNumMessagesReceived , getNumMessagesSent , getOutgoingQueueMaxSize , getOutgoingQueueSize , getReceiveInterfaces , getSendInterfaces , handleConfigEvent , handleDownEvent , isDiscardIncompatiblePackets , isEnableBundling , isLoopback , isReceiveOnAllInterfaces , isSendOnAllInterfaces , isUseIncomingPacketHandler , isUseOutgoingPacketHandler , postUnmarshalling , postUnmarshallingList , receive , resetStats , sendToAllMembers , sendToSingleMember , setBindAddress , setBindToAllInterfaces , setDiscardIncompatiblePackets , setEnableBundling , setLoopback , setMaxBundleSize , setMaxBundleTimeout , setOutgoingQueueMaxSize , setProperties , start , startUpHandler , stop , toString , up |
destroy , down , downThreadEnabled , dumpStats , enableStats , getDownProtocol , getDownQueue , getName , getProperties , getUpProtocol , getUpQueue , handleSpecialDownEvent , init , isTrace , isWarn , passDown , passUp , printStats , providedDownServices , providedUpServices , receiveDownEvent , receiveUpEvent , requiredDownServices , requiredUpServices , resetStats , setDownProtocol , setObserver , setProperties , setPropertiesInternal , setProtocolStack , setTrace , setUpProtocol , setWarn , start , startDownHandler , startUpHandler , statsEnabled , stop , stopInternal , up , upThreadEnabled |
UDP
public UDP()
Creates the UDP protocol, and initializes the
state variables, does however not start any sockets or threads.
getInfo
public String getInfo()
- getInfo in interface TP
handleConfigEvent
protected void handleConfigEvent(HashMap map)
- handleConfigEvent in interface TP
sendToAllMembers
public void sendToAllMembers(byte[] data,
int offset,
int length)
throws Exception
- sendToAllMembers in interface TP
sendToSingleMember
public void sendToSingleMember(Address dest,
byte[] data,
int offset,
int length)
throws Exception
- sendToSingleMember in interface TP
setProperties
public boolean setProperties(Properties props)
Setup the Protocol instance acording to the configuration string.
The following properties are read by the UDP protocol:
- param mcast_addr - the multicast address to use default is 228.8.8.8
- param mcast_port - (int) the port that the multicast is sent on default is 7600
- param ip_mcast - (boolean) flag whether to use IP multicast - default is true
- param ip_ttl - Set the default time-to-live for multicast packets sent out on this socket. default is 32
- setProperties in interface TP
- 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()
throws Exception
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads
- start in interface TP
stop
public void stop()
This method is called on a
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 interface TP
Copyright B) 1998-2005 Bela Ban. All Rights Reserved.