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.

    Author:
    Bela Ban
    • Field Detail

      • initial_hosts_str

        protected java.lang.String initial_hosts_str
      • port_range

        protected int port_range
      • initial_hosts_set_programmatically

        protected boolean initial_hosts_set_programmatically
      • unresolved_hosts

        protected java.util.Collection<java.lang.String> unresolved_hosts
      • max_dynamic_hosts

        protected int max_dynamic_hosts
      • initial_hosts

        protected java.util.Collection<PhysicalAddress> initial_hosts
    • Constructor Detail

      • TCPPING

        public TCPPING()
    • Method Detail

      • getInitialHosts

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

        public java.util.Collection<PhysicalAddress> getResolvedHosts()
      • setInitialHosts

        public <T extends TCPPING> T setInitialHosts​(java.util.Collection<java.net.InetSocketAddress> hosts)
      • setInitialHosts2

        public <T extends TCPPING> T setInitialHosts2​(java.util.Collection<PhysicalAddress> hosts)
      • initialHosts

        public <T extends TCPPING> T initialHosts​(java.util.Collection<java.net.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 java.lang.String getDynamicHostList()
      • clearDynamicHostList

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

        public void init()
                  throws java.lang.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:
        java.lang.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 java.lang.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
      • findMembers

        public void findMembers​(java.util.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 java.lang.String hostsToStr​(java.util.Collection<PhysicalAddress> hosts)