Class TCPPING


public class TCPPING extends Discovery
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
  • Field Details

    • max_dynamic_hosts

      protected int max_dynamic_hosts
    • dynamic_hosts

      protected final BoundedList<PhysicalAddress> dynamic_hosts
      https://jira.jboss.org/jira/browse/JGRP-989
  • Constructor Details

    • TCPPING

      public TCPPING()
  • Method Details

    • getInitialHosts

      public List<IpAddress> 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

      public void setInitialHosts(List<IpAddress> initial_hosts)
    • getPortRange

      public int getPortRange()
    • setPortRange

      public void setPortRange(int port_range)
    • getDynamicHostList

      public String getDynamicHostList()
    • getInitialHostsList

      public String getInitialHostsList()
    • init

      public void init() throws Exception
      Description copied from class: Protocol
      Called 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.
      Overrides:
      init in class Discovery
      Throws:
      Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception
    • start

      public void start() throws Exception
      Description copied from class: Protocol
      This method is called on a Channel.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:
      start in class Discovery
      Throws:
      Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so Channel.connect(String) will throw an exception
    • sendGetMembersRequest

      public void sendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) throws Exception
      Specified by:
      sendGetMembersRequest in class Discovery
      Throws:
      Exception
    • down

      public Object down(Event evt)
      Description copied from class: Discovery
      An 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 using PassDown. 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 using up_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.
      Overrides:
      down in class Discovery
    • discoveryRequestReceived

      public void discoveryRequestReceived(Address sender, String logical_name, Collection<PhysicalAddress> physical_addrs)
      Overrides:
      discoveryRequestReceived in class Discovery