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 being 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
param use_packet_handler - 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 (default is false).
down_handler , down_prot , down_queue , down_thread , down_thread_prio , log , observer , props , stack , up_handler , up_prot , up_queue , up_thread , up_thread_prio |
UDP() - public constructor.
|
void | down(Event evt) - Caller by the layer above this layer.
|
String | getName()
|
void | init() - Called after instance has been created (null constructor) and before protocol is started.
|
void | run()
|
boolean | setProperties(Properties props) - Setup the Protocol instance acording to the configuration string
The following properties are being 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.
|
void | start() - Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads
|
void | startUpHandler() - DON'T REMOVE ! 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() .
|
String | toString() - debug only
|
void | up(Event evt) - handle the UP event.
|
destroy , down , getDownProtocol , getDownQueue , getName , getProperties , getUpProtocol , getUpQueue , handleSpecialDownEvent , init , passDown , passUp , providedDownServices , providedUpServices , receiveDownEvent , receiveUpEvent , requiredDownServices , requiredUpServices , setDownProtocol , setObserver , setProperties , setPropertiesInternal , setProtocolStack , setUpProtocol , start , startDownHandler , startUpHandler , stop , stopInternal , up |
UDP
public UDP()
public constructor. creates the UDP protocol, and initializes the
state variables, does however not start any sockets or threads
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).
- down in interface Protocol
init
public void init()
throws Exception
Called after instance has been created (null constructor) and before protocol is started.
Properties are already set. Other protocols are not yet connected and events cannot yet be sent.
- init in interface Protocol
setProperties
public boolean setProperties(Properties props)
Setup the Protocol instance acording to the configuration string
The following properties are being 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 Protocol
- 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 Protocol
startUpHandler
public void startUpHandler()
DON'T REMOVE ! 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.
- startUpHandler in interface Protocol
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 Protocol
toString
public String toString()
debug only
up
public void up(Event evt)
handle the UP event.
- up in interface Protocol
evt
- - the event being send from the stack
Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.