Package org.jgroups.protocols
Class TCPPING
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.TCPPING
The TCPPING protocol layer retrieves the initial membership in answer to the
GMS's FIND_INITIAL_MBRS event. The initial membership is retrieved by
directly contacting other group members, sending point-to-point membership
requests. The responses should allow us to determine the coordinator whom we
have to contact in case we want to join the group. When we are a server
(after having received the BECOME_SERVER event), we'll respond to TCPPING
requests with a TCPPING response.
The FIND_INITIAL_MBRS event will eventually be answered with a FIND_INITIAL_MBRS_OK event up the stack.
The TCPPING protocol requires a static configuration, which assumes that you to know in advance where to find other members of your group. For dynamic discovery, use the PING protocol, which uses multicast discovery, or the TCPGOSSIP protocol, which contacts a Gossip Router to acquire the initial membership.
- Author:
- Bela Ban
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.Responses -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BoundedList<PhysicalAddress> https://jira.jboss.org/jira/browse/JGRP-989protected intFields inherited from class org.jgroups.protocols.Discovery
group_addr, local_addr, members, ping_responses, rank, timer, view -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddiscoveryRequestReceived(Address sender, String logical_name, Collection<PhysicalAddress> physical_addrs) An event is to be sent down the stack.Returns the list of initial hosts as configured by the user via XML.intvoidinit()Called after instance has been created (null constructor) and before protocol is started.voidsendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) voidsetInitialHosts(List<IpAddress> initial_hosts) voidsetPortRange(int port_range) voidstart()This method is called on aChannel.connect(String).Methods inherited from class org.jgroups.protocols.Discovery
findAllMembers, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, getView, handleConnect, handleDisconnect, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, stop, upMethods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
-
Field Details
-
max_dynamic_hosts
protected int max_dynamic_hosts -
dynamic_hosts
https://jira.jboss.org/jira/browse/JGRP-989
-
-
Constructor Details
-
TCPPING
public TCPPING()
-
-
Method Details
-
getInitialHosts
Returns the list of initial hosts as configured by the user via XML. Note that the returned list is mutable, so careful with changes !- Returns:
- List list of initial hosts. This variable is only set after the channel has been created and set Properties() has been called
-
setInitialHosts
-
getPortRange
public int getPortRange() -
setPortRange
public void setPortRange(int port_range) -
getDynamicHostList
-
getInitialHostsList
-
init
Description copied from class:ProtocolCalled 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. -
start
Description copied from class:ProtocolThis method is called on aChannel.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.- Overrides:
startin classDiscovery- Throws:
Exception- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soChannel.connect(String)will throw an exception
-
sendGetMembersRequest
public void sendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) throws Exception - Specified by:
sendGetMembersRequestin classDiscovery- Throws:
Exception
-
down
Description copied from class:DiscoveryAn event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack usingPassDown. In case of a GET_ADDRESS event (which tries to retrieve the stack's address from one of the bottom layers), the layer may need to send a new response event back up the stack usingup_prot.up(). The PING protocol is interested in several different down events, Event.FIND_INITIAL_MBRS - sent by the GMS layer and expecting a GET_MBRS_OK Event.TMP_VIEW and Event.VIEW_CHANGE - a view change event Event.BECOME_SERVER - called after client has joined and is fully working group member Event.CONNECT, Event.DISCONNECT. -
discoveryRequestReceived
public void discoveryRequestReceived(Address sender, String logical_name, Collection<PhysicalAddress> physical_addrs) - Overrides:
discoveryRequestReceivedin classDiscovery
-