Class TCPPING

All Implemented Interfaces:
Lifecycle

public class TCPPING extends Discovery
The TCPPING protocol defines a static cluster membership. The cluster members are retrieved by directly contacting the members listed in initial_hosts, sending point-to-point discovery requests.

The TCPPING protocol defines a static configuration, which requires that you to know in advance where to find all of the members of your cluster.

  • Field Details

    • initial_hosts_str

      protected String initial_hosts_str
    • initial_hosts_file

      protected String initial_hosts_file
    • port_range

      protected int port_range
    • initial_hosts_set_programmatically

      protected boolean initial_hosts_set_programmatically
    • unresolved_hosts

      protected Collection<String> unresolved_hosts
    • max_dynamic_hosts

      protected int max_dynamic_hosts
    • initial_hosts

      protected Collection<PhysicalAddress> initial_hosts
    • dynamic_hosts

      protected BoundedList<PhysicalAddress> dynamic_hosts
      https://issues.redhat.com/browse/JGRP-989
    • default_port

      protected int default_port
    • stack_type

      protected StackType stack_type
  • Constructor Details

    • TCPPING

      public TCPPING()
  • Method Details

    • isDynamic

      public boolean isDynamic()
      Specified by:
      isDynamic in class Discovery
    • getInitialHosts

      public Collection<PhysicalAddress> 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 of initial hosts. This variable is only set after the channel has been created and set Properties() has been called
    • getResolvedHosts

      public Collection<PhysicalAddress> getResolvedHosts()
    • setInitialHosts

      public <T extends TCPPING> T setInitialHosts(Collection<InetSocketAddress> hosts)
    • setInitialHosts2

      public <T extends TCPPING> T setInitialHosts2(Collection<PhysicalAddress> hosts)
    • initialHosts

      public <T extends TCPPING> T initialHosts(Collection<InetSocketAddress> h)
    • getPortRange

      public int getPortRange()
    • setPortRange

      public <T extends TCPPING> T setPortRange(int port_range)
    • portRange

      public <T extends TCPPING> T portRange(int r)
    • getDynamicHostList

      public String getDynamicHostList()
    • clearDynamicHostList

      public <T extends TCPPING> T clearDynamicHostList()
    • init

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

      public Object down(Event evt)
      Description copied from class: Protocol
      An event is to be sent down the stack. A protocol 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 protocol may need to add a header to it (or do nothing at all) before sending it down the stack using down_prot.down().
      Overrides:
      down in class Discovery
    • discoveryRequestReceived

      public void discoveryRequestReceived(Address sender, String logical_name, PhysicalAddress physical_addr)
      Overrides:
      discoveryRequestReceived in class Discovery
    • findMembers

      public void findMembers(List<Address> members, boolean initial_discovery, Responses responses)
      Description copied from class: Discovery
      Fetches information (e.g. physical address, logical name) for the given member addresses. Needs to add responses to the Responses object. If Discovery.async_discovery is true, this method will be called in a separate thread, otherwise the caller's thread will be used.
      Specified by:
      findMembers in class Discovery
      Parameters:
      members - A list of logical addresses (typically UUIDs). If null, then information for all members is fetched
      initial_discovery - Set to true if this is for the initial membership discovery. Some protocols (e.g. file based ones) may return only the information for the coordinator(s).
      responses - The list to which responses should be added
    • sendDiscoveryRequest

      protected void sendDiscoveryRequest(Message req)
    • hostsToStr

      protected static String hostsToStr(Collection<PhysicalAddress> hosts)