Class TCPGOSSIP

  • All Implemented Interfaces:
    RouterStub.MembersNotification

    public class TCPGOSSIP
    extends Discovery
    implements RouterStub.MembersNotification
    The TCPGOSSIP protocol layer retrieves the initial membership (used by GMS when started by sending event FIND_INITIAL_MBRS down the stack). We do this by contacting one or more GossipRouters, which must be running at well-known addresses:ports. The responses should allow us to determine the coordinator whom we have to contact, e.g. in case we want to join the group. When we are a server (after having received the BECOME_SERVER event), we'll respond to TCPGOSSIP requests with a TCPGOSSIP response.
    Since:
    a long time ago
    Author:
    Bela Ban
    • Field Detail

      • sock_conn_timeout

        protected int sock_conn_timeout
      • reconnect_interval

        protected long reconnect_interval
      • use_nio

        protected boolean use_nio
    • Constructor Detail

      • TCPGOSSIP

        public TCPGOSSIP()
    • Method Detail

      • setInitialHosts

        public void setInitialHosts​(java.util.List<java.net.InetSocketAddress> hosts)
      • setInitialHosts

        public void setInitialHosts​(java.util.Collection<java.net.InetSocketAddress> hosts)
      • getInitialHosts

        public java.util.List<java.net.InetSocketAddress> getInitialHosts()
      • init

        public void init()
                  throws java.lang.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:
        java.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception
      • stop

        public void stop()
        Description copied from class: Protocol
        This method is called on a JChannel.disconnect(). Stops work (e.g. by closing multicast socket). Will be called from top to bottom. This means that at the time of the method invocation the neighbor protocol below is still working. This method will replace the STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that when this method is called all messages in the down queue will have been flushed
        Overrides:
        stop in class Discovery
      • destroy

        public void destroy()
        Description copied from class: Protocol
        This method is called on a JChannel.close(). Does some cleanup; after the call the VM will terminate
        Overrides:
        destroy in class Protocol
      • print

        public java.lang.String print()
      • printStubs

        public java.lang.String printStubs()
      • printReconnectList

        public java.lang.String printReconnectList()
      • 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
      • addInitialHost

        public void addInitialHost​(java.lang.String hostname,
                                   int port)
      • removeInitialHost

        public boolean removeInitialHost​(java.lang.String hostname,
                                         int port)