public class UDP extends TP implements java.lang.Runnable
The following properties are read by the UDP protocol:
Modifier and Type | Class and Description |
---|---|
class |
UDP.UcastReceiver |
bind_addr, channel_name, local_addr, members, timer, view
down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, up_handler, up_prot, up_queue, up_thread, up_thread_prio
Constructor and Description |
---|
UDP()
Creates the UDP protocol, and initializes the
state variables, does however not start any sockets or threads.
|
Modifier and Type | Method and Description |
---|---|
protected java.net.DatagramSocket |
createDatagramSocketWithBindPort()
Creates a DatagramSocket when bind_port > 0.
|
protected java.net.DatagramSocket |
createEphemeralDatagramSocket()
Creates a DatagramSocket with a random port.
|
java.lang.String |
getInfo() |
java.lang.String |
getName() |
protected void |
handleConfigEvent(java.util.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)
Send to all members in the group.
|
void |
sendToSingleMember(Address dest,
byte[] data,
int offset,
int length)
Send to all members in the group.
|
boolean |
setProperties(java.util.Properties props)
Setup the Protocol instance acording 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() . |
protected void |
unsetThreadNames() |
down, dumpStats, getBindAddress, getBindToAllInterfaces, getChannelName, getIncomingQueueSize, getLocalAddress, getMaxBundleSize, getMaxBundleTimeout, getNumBytesReceived, getNumBytesSent, getNumMessagesReceived, getNumMessagesSent, getOutgoingQueueMaxSize, getOutgoingQueueSize, getReceiveInterfaces, getSendInterfaces, handleDownEvent, init, isDiscardIncompatiblePackets, isEnableBundling, isLoopback, isReceiveOnAllInterfaces, isSendOnAllInterfaces, isUseIncomingPacketHandler, isUseOutgoingPacketHandler, receive, resetStats, setBindAddress, setBindToAllInterfaces, setDiscardIncompatiblePackets, setEnableBundling, setLoopback, setMaxBundleSize, setMaxBundleTimeout, setOutgoingQueueMaxSize, startUpHandler, toString, up
destroy, downThreadEnabled, enableStats, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setUpProtocol, startDownHandler, statsEnabled, stopInternal, upThreadEnabled
public UDP()
public boolean setProperties(java.util.Properties props)
setProperties
in class TP
public void run()
run
in interface java.lang.Runnable
public void sendToAllMembers(byte[] data, int offset, int length) throws java.lang.Exception
TP
sendToAllMembers
in class TP
data
- The data to be sent. This is not a copy, so don't modify itjava.lang.Exception
public void sendToSingleMember(Address dest, byte[] data, int offset, int length) throws java.lang.Exception
TP
sendToSingleMember
in class TP
dest
- Must be a non-null unicast addressdata
- The data to be sent. This is not a copy, so don't modify itjava.lang.Exception
public void postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)
postUnmarshalling
in class TP
public void postUnmarshallingList(Message msg, Address dest, boolean multicast)
postUnmarshallingList
in class TP
public void start() throws java.lang.Exception
start
in class TP
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 flushedprotected java.net.DatagramSocket createEphemeralDatagramSocket() throws java.net.SocketException
java.net.SocketException
protected java.net.DatagramSocket createDatagramSocketWithBindPort() throws java.lang.Exception
java.lang.Exception
protected void setThreadNames()
setThreadNames
in class TP
protected void unsetThreadNames()
unsetThreadNames
in class TP
protected void handleConfigEvent(java.util.HashMap map)
handleConfigEvent
in class TP
Copyright ? 1998-2006 Bela Ban. All Rights Reserved.