public class MPING extends PING implements Runnable
The discovery is asymmetric: discovery requests are broadcast via the multicast socket, and received via the multicast socket by everyone in the group. However, the discovery responses are sent back via the regular transport (e.g. TCP) to the sender (discovery request contained sender's regular address, e.g. 192.168.0.2:7800).
Discovery.DiscoveryCacheDisseminationTask
Modifier and Type | Field and Description |
---|---|
protected InetAddress |
bind_addr |
protected String |
bind_interface_str |
protected static boolean |
can_bind_to_mcast_addr |
protected int |
ip_ttl |
protected InetAddress |
mcast_addr |
protected int |
mcast_port |
protected MulticastSocket[] |
mcast_send_sockets
If we have multiple mcast send sockets, e.g.
|
protected MulticastSocket |
mcast_sock |
protected List<NetworkInterface> |
receive_interfaces
List
|
protected boolean |
receive_on_all_interfaces |
protected Thread |
receiver |
protected List<NetworkInterface> |
send_interfaces
List
|
protected boolean |
send_on_all_interfaces
If true, the transport should use all available interfaces to send
multicast messages.
|
async_discovery, async_discovery_use_separate_thread_per_request, break_on_coord_rsp, cluster_name, current_coord, discovery_rsp_expiry_time, is_coord, is_leaving, is_server, local_addr, max_members_in_discovery_request, max_rank_to_reply, num_discovery_requests, ping_responses, return_entire_cache, send_cache_on_join, sends_can_block, stagger_timeout, timer, transport_supports_multicasting, use_disk_cache, use_ip_addrs, view, WHITESPACE
after_creation_hook, down_prot, ergonomics, id, log, stack, stats, up_prot
Constructor and Description |
---|
MPING() |
Modifier and Type | Method and Description |
---|---|
protected void |
bindToInterfaces(List<NetworkInterface> interfaces,
MulticastSocket s,
InetAddress mcast_addr) |
InetAddress |
getBindAddr() |
InetAddress |
getMcastAddr() |
int |
getMcastPort() |
List<NetworkInterface> |
getReceiveInterfaces() |
List<NetworkInterface> |
getSendInterfaces() |
int |
getTTL() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
boolean |
isReceiveOnAllInterfaces() |
boolean |
isSendOnAllInterfaces() |
void |
run() |
protected void |
sendMcastDiscoveryRequest(Message msg) |
void |
setBindAddr(InetAddress bind_addr) |
void |
setMcastAddr(InetAddress mcast_addr) |
void |
setMcastPort(int mcast_port) |
void |
setMulticastAddress(String addr) |
void |
setTTL(int ip_ttl) |
void |
start()
This method is called on a
JChannel.connect(String) . |
protected void |
startReceiver() |
void |
stop()
This method is called on a
JChannel.disconnect() . |
Object |
up(Event evt)
An event was received from the protocol below.
|
findMembers, isDynamic, sendDiscoveryRequest
addDiscoveryResponseToCaches, addResponse, addResponse, addressAsString, addToCache, breakOnCoordResponse, breakOnCoordResponse, deserialize, discoveryRequestReceived, discoveryRspExpiryTime, disseminateDiscoveryInformation, down, dumpCache, findInitialMembersAsString, findMembers, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handleConnect, handleDisconnect, handleDiscoveryResponse, isCoord, isMergeRunning, marshal, providedUpServices, read, readPingData, resetStats, returnEntireCache, returnEntireCache, sendCacheInformation, sendDiscoveryResponse, serializeWithoutView, staggerTimeout, staggerTimeout, startCacheDissemination, up, useDiskCache, useDiskCache, weedOutCompletedDiscoveryResponses, write
accept, afterCreationHook, destroy, down, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, providedDownServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, up
protected static final boolean can_bind_to_mcast_addr
protected InetAddress bind_addr
protected String bind_interface_str
protected int ip_ttl
protected InetAddress mcast_addr
protected int mcast_port
protected boolean receive_on_all_interfaces
protected List<NetworkInterface> receive_interfaces
protected boolean send_on_all_interfaces
protected List<NetworkInterface> send_interfaces
protected MulticastSocket mcast_sock
protected MulticastSocket[] mcast_send_sockets
protected volatile Thread receiver
public InetAddress getBindAddr()
public void setBindAddr(InetAddress bind_addr)
public List<NetworkInterface> getReceiveInterfaces()
public List<NetworkInterface> getSendInterfaces()
public boolean isReceiveOnAllInterfaces()
public boolean isSendOnAllInterfaces()
public int getTTL()
public void setTTL(int ip_ttl)
public InetAddress getMcastAddr()
public void setMcastAddr(InetAddress mcast_addr)
public void setMulticastAddress(String addr) throws UnknownHostException
UnknownHostException
public int getMcastPort()
public void setMcastPort(int mcast_port)
public Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up the stack using up_prot.up()
.public void init() throws Exception
Protocol
public void start() throws Exception
Protocol
JChannel.connect(String)
. Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.start
in class Discovery
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 bindToInterfaces(List<NetworkInterface> interfaces, MulticastSocket s, InetAddress mcast_addr) throws IOException
IOException
protected void startReceiver()
protected void sendMcastDiscoveryRequest(Message msg)
sendMcastDiscoveryRequest
in class PING
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.