public class UDP extends TP
The following properties are read by the UDP protocol:
Modifier and Type | Class and Description |
---|---|
class |
UDP.PacketReceiver |
Modifier and Type | Field and Description |
---|---|
protected boolean |
disable_loopback |
protected boolean |
ip_mcast |
protected int |
ip_ttl |
protected static boolean |
is_android |
protected static boolean |
is_mac |
protected IpAddress |
mcast_addr
The multicast address (mcast address and port) this member uses
|
protected InetAddress |
mcast_group_addr |
protected static String |
MCAST_NAME |
protected int |
mcast_port |
protected UDP.PacketReceiver[] |
mcast_receivers
Runnable to receive multicast packets
|
protected int |
mcast_recv_buf_size |
protected int |
mcast_send_buf_size |
protected MulticastSocket |
mcast_sock
IP multicast socket for receiving multicast packets
|
protected int |
multicast_receiver_threads |
protected MulticastSocket |
sock
Socket used for
sending unicast and multicast packets and
receiving unicast packets
The address of this socket will be our local address (local_addr)
|
protected SuppressLog<InetAddress> |
suppress_log_out_of_buffer_space |
protected long |
suppress_time_out_of_buffer_space |
protected int |
tos
Traffic class for sending unicast and multicast datagrams.
|
protected static String |
UCAST_NAME |
protected UDP.PacketReceiver[] |
ucast_receivers
Runnable to receive unicast packets
|
protected int |
ucast_recv_buf_size |
protected int |
ucast_send_buf_size |
protected int |
unicast_receiver_threads |
avg_batch_size, bind_addr, bind_port, bundler, bundler_capacity, bundler_num_spins, bundler_type, bundler_wait_strategy, can_bind_to_mcast_addr, cluster_name, connectLock, diag_handler, diagnostics_addr, diagnostics_bind_interfaces, diagnostics_passcode, diagnostics_port, diagnostics_ttl, enable_diagnostics, external_addr, external_port, header, internal_pool, internal_thread_factory, is_trace, last_discovery_request, LIST, local_addr, local_physical_addr, log_discard_msgs, log_discard_msgs_version, logical_addr_cache, logical_addr_cache_expiration, logical_addr_cache_max_size, logical_addr_cache_reaper, logical_addr_cache_reaper_interval, loopback_copy, loopback_separate_thread, max_bundle_size, members, message_processing_policy, MIN_WAIT_BETWEEN_DISCOVERIES, MSG_OVERHEAD, msg_processing_max_buffer_size, msg_processing_policy, msg_stats, MULTICAST, port_range, preregistered_probe_handlers, print_function, receive_interfaces, receive_on_all_interfaces, socket_factory, suppress_log_different_cluster, suppress_log_different_version, suppress_time_different_cluster_warnings, suppress_time_different_version_warnings, thread_factory, thread_naming_pattern, thread_pool, thread_pool_enabled, thread_pool_keep_alive_time, thread_pool_max_threads, thread_pool_min_threads, time_service, time_service_interval, timer, timer_handle_non_blocking_tasks, use_common_fork_join_pool, use_fork_join_pool, use_ip_addrs, view, who_has_cache, who_has_cache_timeout
after_creation_hook, down_prot, ergonomics, id, log, stack, stats, up_prot
Constructor and Description |
---|
UDP() |
Modifier and Type | Method and Description |
---|---|
protected void |
_send(InetAddress dest,
int port,
byte[] data,
int offset,
int length) |
protected void |
bindToInterfaces(List<NetworkInterface> interfaces,
MulticastSocket s,
InetAddress mcastAddr) |
void |
clearDroppedMessagesCache() |
protected void |
closeUnicastSocket() |
protected IpAddress |
createLocalAddress() |
protected MulticastSocket |
createMulticastSocket(String service_name,
int port) |
protected MulticastSocket |
createMulticastSocketWithBindPort()
Creates a DatagramSocket when bind_port > 0.
|
protected UDP.PacketReceiver[] |
createReceivers(int num,
DatagramSocket sock,
String name) |
protected void |
createSockets()
Creates the UDP sender and receiver sockets
|
protected void |
destroySockets() |
protected String |
dumpSocketInfo() |
protected static Method |
findMethod(Class<?> clazz,
String method_name,
Class<?>... parameters) |
int |
getDroppedMessages() |
String |
getInfo() |
int |
getMcastReceiverThreads() |
InetAddress |
getMulticastAddress() |
int |
getMulticastPort() |
int |
getMulticastTTL() |
protected PhysicalAddress |
getPhysicalAddress() |
int |
getUcastReceiverThreads() |
protected void |
handleConfigEvent(Map<String,Object> map) |
protected void |
handleConnect() |
protected Object |
handleDownEvent(Event evt) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
void |
sendMulticast(byte[] data,
int offset,
int length)
Send to all members in the group.
|
void |
sendUnicast(PhysicalAddress dest,
byte[] data,
int offset,
int length)
Send a unicast to 1 member.
|
protected void |
setBufferSize(DatagramSocket sock,
int send_buf_size,
int recv_buf_size) |
protected void |
setInterface(InetAddress intf,
MulticastSocket s) |
UDP |
setMaxBundleSize(int size) |
void |
setMcastPort(int mcast_port) |
void |
setMcastReceiverThreads(int num) |
void |
setMulticastAddress(InetAddress addr) |
UDP |
setMulticasting(boolean fl) |
void |
setMulticastPort(int mcast_port) |
void |
setMulticastTTL(int ttl)
Set the ttl for multicast socket
|
protected void |
setTimeToLive(int ttl,
MulticastSocket s) |
void |
setUcastReceiverThreads(int num) |
void |
start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads
|
protected void |
startMcastReceiverThreads() |
protected void |
startThreads() |
protected void |
startUcastReceiverThreads() |
void |
stop()
This method is called on a
JChannel.disconnect() . |
protected void |
stopMcastReceiverThreads() |
protected void |
stopThreads() |
protected void |
stopUcastReceiverThreads() |
boolean |
supportsMulticasting()
Whether or not hardware multicasting is supported
|
_send, addPhysicalAddressToCache, addPhysicalAddressToCache, avgBatchSize, bundler, bundlerNumSpins, bundlerNumSpins, bundlerStats, bundlerStatsReset, bundlerWaitStrategy, bundlerWaitStrategy, clearDifferentClusterCache, clearDifferentVersionCache, clearLogicalAddressCache, createBundler, createThreadPool, destroy, disableDiagnostics, doSend, down, down, dumpTimerTasks, enableBlockingTimerTasks, enableDiagnostics, evictLogicalAddressCache, evictLogicalAddressCache, fetchLocalAddresses, fetchPhysicalAddrs, fetchResponsesFromDiscoveryProtocol, getAllPhysicalAddressesFromCache, getAvgBatchSize, getBindAddress, getBindPort, getBundler, getBundlerBufferSize, getBundlerCapacity, getBundlerClass, getClusterName, getClusterNameAscii, getDifferentClusterMessages, getDifferentVersionMessages, getInternalThreadPool, getInternalThreadPoolSize, getInternalThreadPoolSizeLargest, getInternalThreadPoolThreadFactory, getJmxObjects, getLocalAddress, getLocalPhysicalAddress, getLogDiscardMessages, getLogDiscardMessagesVersion, getMaxBundleSize, getMessageProcessingMaxBufferSize, getMessageStats, getNumMessagesSent, getNumThreads, getNumTimerTasks, getPhysicalAddressFromCache, getPortRange, getReceiveInterfaces, getSocketFactory, getThreadFactory, getThreadNamingPattern, getThreadPool, getThreadPoolKeepAliveTime, getThreadPoolMaxThreads, getThreadPoolMinThreads, getThreadPoolSize, getThreadPoolSizeActive, getThreadPoolSizeLargest, getThreadPoolThreadFactory, getTimer, getTimerClass, getTimerThreads, getTimeService, getUseIpAddresses, handleDisconnect, handleMessageBatch, handleProbe, handleSingleMessage, incrBatchesSent, incrNumSingleMsgsSent, isDiagnosticsHandlerRunning, isLogicalAddressCacheReaperRunning, isMulticastCapable, isReceiveOnAllInterfaces, localAddress, loggerType, loopback, passBatchUp, passMessageUp, printLogicalAddressCache, printWhoHasCache, processBatch, receive, receive, registerLocalAddress, registerProbeHandler, removeLogicalAddressFromCache, resetStats, runInNewThread, send, sendToMembers, sendToSingleMember, setBindAddress, setBindPort, setBindToAllInterfaces, setBundler, setDiagnosticsHandler, setInAllThreadFactories, setInternalThreadPool, setInternalThreadPoolThreadFactory, setLevel, setLogDiscardMessages, setLogDiscardMessagesVersion, setMessageProcessingPolicy, setPortRange, setSocketFactory, setSourceAddress, setThreadFactory, setThreadNames, setThreadPool, setThreadPoolKeepAliveTime, setThreadPoolMaxThreads, setThreadPoolMinThreads, setThreadPoolThreadFactory, setTimer, setTimeService, shutdownThreadPool, startDiagnostics, stopDiagnostics, submitToThreadPool, submitToThreadPool, supportedKeys, toString, unicastDestMismatch, unregisterProbeHandler, unsetThreadNames, versionMatch, view
accept, afterCreationHook, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setProperties, setProtocolStack, setUpProtocol, setValue, statsEnabled, up, up, up
protected int tos
DatagramSocket.setTrafficClass(int)
); for details):
IPTOS_LOWCOST (0x02)
, decimal 2IPTOS_RELIABILITY (0x04)
<, decimal 4/li>
IPTOS_THROUGHPUT (0x08)
, decimal 8IPTOS_LOWDELAY (0x10)
, decimal 16protected static final String UCAST_NAME
protected static final String MCAST_NAME
protected InetAddress mcast_group_addr
protected int mcast_port
protected boolean ip_mcast
protected int ip_ttl
protected int mcast_send_buf_size
protected int mcast_recv_buf_size
protected int ucast_send_buf_size
protected int ucast_recv_buf_size
protected boolean disable_loopback
protected long suppress_time_out_of_buffer_space
protected int unicast_receiver_threads
protected int multicast_receiver_threads
protected IpAddress mcast_addr
protected MulticastSocket sock
protected MulticastSocket mcast_sock
protected UDP.PacketReceiver[] mcast_receivers
protected UDP.PacketReceiver[] ucast_receivers
protected SuppressLog<InetAddress> suppress_log_out_of_buffer_space
protected static final boolean is_android
protected static final boolean is_mac
public boolean supportsMulticasting()
TP
supportsMulticasting
in class TP
public UDP setMulticasting(boolean fl)
public void setMulticastAddress(InetAddress addr)
public InetAddress getMulticastAddress()
public int getMulticastPort()
public void setMulticastPort(int mcast_port)
public void setMcastPort(int mcast_port)
public void setMulticastTTL(int ttl)
ttl
- the time to live for the socket.public int getMulticastTTL()
public UDP setMaxBundleSize(int size)
setMaxBundleSize
in class TP
public int getDroppedMessages()
public void clearDroppedMessagesCache()
public void setUcastReceiverThreads(int num)
public int getUcastReceiverThreads()
public void setMcastReceiverThreads(int num)
public int getMcastReceiverThreads()
public void sendMulticast(byte[] data, int offset, int length) throws Exception
TP
sendMulticast
in class TP
data
- The data to be sent. This is not a copy, so don't modify itException
public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws Exception
TP
sendUnicast
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 itException
protected void _send(InetAddress dest, int port, byte[] data, int offset, int length) throws Exception
Exception
protected Object handleDownEvent(Event evt)
handleDownEvent
in class TP
public void init() throws Exception
Protocol
public void start() throws Exception
start
in class TP
Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so JChannel.connect(String)
will throw an exceptionpublic void stop()
Protocol
JChannel.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 void handleConnect() throws Exception
handleConnect
in class TP
Exception
protected static Method findMethod(Class<?> clazz, String method_name, Class<?>... parameters)
protected void createSockets() throws Exception
Exception
protected void destroySockets()
protected UDP.PacketReceiver[] createReceivers(int num, DatagramSocket sock, String name)
protected IpAddress createLocalAddress()
protected void setTimeToLive(int ttl, MulticastSocket s)
protected void setInterface(InetAddress intf, MulticastSocket s)
protected PhysicalAddress getPhysicalAddress()
getPhysicalAddress
in class TP
protected void bindToInterfaces(List<NetworkInterface> interfaces, MulticastSocket s, InetAddress mcastAddr)
interfaces
- Lists
- mcastAddr
- IOException
protected MulticastSocket createMulticastSocketWithBindPort() throws Exception
Exception
protected MulticastSocket createMulticastSocket(String service_name, int port) throws Exception
Exception
protected void setBufferSize(DatagramSocket sock, int send_buf_size, int recv_buf_size)
protected void closeUnicastSocket()
protected void startUcastReceiverThreads()
protected void startMcastReceiverThreads()
protected void stopThreads()
protected void stopUcastReceiverThreads()
protected void stopMcastReceiverThreads()
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.