Package org.jgroups.protocols
Class LOCAL_PING
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.Discovery
-
- org.jgroups.protocols.LOCAL_PING
-
- All Implemented Interfaces:
Lifecycle
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.DiscoveryCacheDisseminationTask
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Map<java.lang.String,java.util.List<PingData>>discoveryMap of cluster names and address-protocol mappings.protected static java.util.function.Function<java.lang.String,java.util.List<PingData>>FUNC-
Fields inherited from class org.jgroups.protocols.Discovery
async_discovery, async_discovery_use_separate_thread_per_request, break_on_coord_rsp, cluster_name, current_coord, discovery_req_futures, discovery_rsp_callback, discovery_rsp_expiry_time, is_coord, is_leaving, is_server, max_members_in_discovery_request, max_rank_to_reply, num_discovery_requests, num_discovery_runs, ping_responses, return_entire_cache, send_cache_on_join, sends_can_block, stagger_timeout, timer, transport, transport_supports_multicasting, use_disk_cache, view, WHITESPACE
-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot
-
-
Constructor Summary
Constructors Constructor Description LOCAL_PING()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAddressToLocalCache(Address addr, PhysicalAddress phys_addr)static voidclear()java.lang.Objectdown(Event evt)An event is to be sent down the stack.ResponsesfindMembers(java.util.List<Address> members, boolean initial_discovery, boolean async, long timeout)voidfindMembers(java.util.List<Address> members, boolean initial_discovery, Responses responses)Fetches information (e.g.static intgetDiscoveryCacheSize()voidhandleConnect()voidhandleDisconnect()booleanisDynamic()static java.lang.Stringprint()voidstop()Called on aJChannel.disconnect(); stops work (e.g.-
Methods inherited from class org.jgroups.protocols.Discovery
addDiscoveryResponseToCaches, addResponse, addResponse, addressAsString, addToCache, breakOnCoordResponse, breakOnCoordResponse, callFindMembersInAllDiscoveryProtocols, clearRequestFutures, deserialize, discoveryRequestReceived, discoveryRspExpiryTime, disseminateDiscoveryInformation, dumpCache, findInitialMembersAsString, findTopmostDiscoveryProtocol, getClusterName, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handle, handleDiscoveryResponse, handleDiscoveryResponse, init, isCoord, isMergeRunning, marshal, marshal, marshal, print, providedUpServices, read, readPingData, resetStats, returnEntireCache, returnEntireCache, sendCacheInformation, sendCacheOnJoin, sendCacheOnJoin, sendDiscoveryResponse, sendDiscoveryResponse, serializeWithoutView, setClusterName, staggerTimeout, staggerTimeout, start, startCacheDissemination, up, up, up, useDiskCache, useDiskCache, weedOutCompletedDiscoveryResponses, write
-
Methods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, toString
-
-
-
-
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
-
-
Method Detail
-
stop
public void stop()
Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom.
-
clear
public static void clear()
-
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:
findMembersin classDiscovery
-
findMembers
public void findMembers(java.util.List<Address> members, boolean initial_discovery, Responses responses)
Description copied from class:DiscoveryFetches information (e.g. physical address, logical name) for the given member addresses. Needs to add responses to theResponsesobject. IfDiscovery.async_discoveryis true, this method will be called in a separate thread, otherwise the caller's thread will be used.- Specified by:
findMembersin classDiscovery- Parameters:
members- A list of logical addresses (typicallyUUIDs). If null, then information for all members is fetchedinitial_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:ProtocolAn 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 usingdown_prot.down().
-
handleConnect
public void handleConnect()
- Overrides:
handleConnectin classDiscovery
-
handleDisconnect
public void handleDisconnect()
- Overrides:
handleDisconnectin classDiscovery
-
addAddressToLocalCache
protected void addAddressToLocalCache(Address addr, PhysicalAddress phys_addr)
-
-