Package org.jgroups.protocols
Class MPING
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.PING
org.jgroups.protocols.MPING
Uses its own IP multicast socket to send and receive discovery requests/responses. Can be used in
conjuntion with a non-UDP transport, e.g. TCP.
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 contains sender's regular address, e.g. 192.168.0.2:7800).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.DiscoveryCacheDisseminationTask -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InetAddressprotected Stringprotected intprotected InetAddressprotected intprotected MulticastSocketprotected MulticastSocketprotected MulticastSocket[]protected List<NetworkInterface> List of interfaces to receive multicasts on.protected booleanprotected Threadprotected List<NetworkInterface> List of interfaces to send multicasts on.protected booleanIf true, the transport should use all available interfaces to send multicast messages.Fields inherited from class org.jgroups.protocols.Discovery
async_discovery, async_discovery_use_separate_thread_per_request, break_on_coord_rsp, cluster_name, current_coord, discovery_req_futures, discovery_rsp_callback, discovery_rsp_expiry_time, is_coord, is_leaving, is_server, max_members_in_discovery_request, max_rank_to_reply, num_discovery_requests, num_discovery_runs, ping_responses, return_entire_cache, send_cache_on_join, sends_can_block, stagger_timeout, timer, transport, transport_supports_multicasting, use_disk_cache, view, WHITESPACEFields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbindToInterfaces(List<NetworkInterface> interfaces, MulticastSocket s, InetAddress mcast_addr) protected MulticastSocketcreateMulticastSocket(String service_name, int port) intintgetTTL()voidinit()Called after a protocol has been created and before the protocol is started.booleanbooleanvoidrun()protected voidprotected <T extends MPING>
TsetInterface(InetAddress intf, MulticastSocket s) setMcastPort(int p) setTTL(int ip_ttl) voidstart()This method is called on aJChannel.connect(String); starts work.protected voidvoidstop()Called on aJChannel.disconnect(); stops work (e.g.An event was received from the protocol below.Methods inherited from class org.jgroups.protocols.PING
findMembers, isDynamic, sendDiscoveryRequestMethods inherited from class org.jgroups.protocols.Discovery
addDiscoveryResponseToCaches, addResponse, addResponse, addressAsString, addToCache, breakOnCoordResponse, breakOnCoordResponse, callFindMembersInAllDiscoveryProtocols, clearRequestFutures, deserialize, discoveryRequestReceived, discoveryRspExpiryTime, disseminateDiscoveryInformation, down, dumpCache, findInitialMembersAsString, findMembers, findTopmostDiscoveryProtocol, getClusterName, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handle, handleConnect, handleDisconnect, handleDiscoveryResponse, handleDiscoveryResponse, isCoord, isMergeRunning, marshal, marshal, marshal, print, providedUpServices, read, readPingData, resetStats, returnEntireCache, returnEntireCache, sendCacheInformation, sendCacheOnJoin, sendCacheOnJoin, sendDiscoveryResponse, sendDiscoveryResponse, serializeWithoutView, setClusterName, staggerTimeout, staggerTimeout, startCacheDissemination, up, up, useDiskCache, useDiskCache, weedOutCompletedDiscoveryResponses, writeMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, toString
-
Field Details
-
bind_addr
-
bind_interface_str
-
ip_ttl
protected int ip_ttl -
mcast_addr
-
mcast_port
protected int mcast_port -
receive_on_all_interfaces
protected boolean receive_on_all_interfaces -
receive_interfaces
List of interfaces to receive multicasts on. The multicast receive socket will listen on all of these interfaces. This is a comma-separated list of IP addresses or interface names. E.g. "192.168.5.1,eth1,127.0.0.1". Duplicates are discarded; we only bind to an interface once. If this property is set, it overrides receive_on_all_interfaces. -
send_on_all_interfaces
protected boolean send_on_all_interfacesIf true, the transport should use all available interfaces to send multicast messages. This means the same multicast message is sent N times, so use with care -
send_interfaces
List of interfaces to send multicasts on. The multicast send socket will send the same multicast message on all of these interfaces. This is a comma-separated list of IP addresses or interface names. E.g. "192.168.5.1,eth1,127.0.0.1". Duplicates are discarded. If this property is set, it override send_on_all_interfaces. -
mcast_receive_sock
-
mcast_send_sock
-
mcast_send_sockets
-
receiver
-
-
Constructor Details
-
MPING
public MPING()
-
-
Method Details
-
getBindAddr
-
setBindAddr
-
getReceiveInterfaces
-
getSendInterfaces
-
isReceiveOnAllInterfaces
public boolean isReceiveOnAllInterfaces() -
isSendOnAllInterfaces
public boolean isSendOnAllInterfaces() -
getTTL
public int getTTL() -
setTTL
-
getMcastAddr
-
mcastAddress
-
setMcastAddr
-
getMcastPort
public int getMcastPort() -
setMcastPort
-
setMulticastAddress
- Throws:
UnknownHostException
-
up
Description copied from class:ProtocolAn event was received from the protocol below. Usually the current protocol will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally, the event is either a) discarded, or b) an event is sent down the stack usingdown_prot.down()or c) the event (or another event) is sent up the stack usingup_prot.up(). -
init
Description copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent. -
start
Description copied from class:ProtocolThis method is called on aJChannel.connect(String); starts work. Protocols are connected ready to receive events. Will be called from bottom to top. -
stop
public void stop()Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom. -
run
public void run() -
createMulticastSocket
- Throws:
Exception
-
setInterface
-
bindToInterfaces
protected void bindToInterfaces(List<NetworkInterface> interfaces, MulticastSocket s, InetAddress mcast_addr) throws IOException - Throws:
IOException
-
startReceiver
protected void startReceiver() -
sendMcastDiscoveryRequest
- Overrides:
sendMcastDiscoveryRequestin classPING
-