Class LOCAL_PING


  • public class LOCAL_PING
    extends Discovery
    Discovery protocol for finding members in the local process only. Doesn't send discovery requests and responses, but fetches discovery information directly from a hashmap. Used mainly by unit test.
    Since:
    4.1.3
    Author:
    Bela Ban
    • Field Detail

      • discovery

        protected static final java.util.Map<java.lang.String,​java.util.List<PingData>> discovery
        Map of cluster names and address-protocol mappings. Used for routing messages to all or single members
      • FUNC

        protected static final java.util.function.Function<java.lang.String,​java.util.List<PingData>> FUNC
    • Constructor Detail

      • LOCAL_PING

        public LOCAL_PING()
    • Method Detail

      • 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
      • print

        public static java.lang.String print()
      • getDiscoveryCacheSize

        public static int getDiscoveryCacheSize()
      • findMembers

        public Responses findMembers​(java.util.List<Address> members,
                                     boolean initial_discovery,
                                     boolean async,
                                     long timeout)
        Overrides:
        findMembers 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
      • 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • addAddressToLocalCache

        protected void addAddressToLocalCache​(Address addr,
                                              PhysicalAddress phys_addr)