Package org.jgroups.protocols
Class LOCAL_PING
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.Discovery
-
- org.jgroups.protocols.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
-
-
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>>
discovery
Map 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, local_addr, 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, use_ip_addrs, view, WHITESPACE
-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, log, 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 void
addAddressToLocalCache(Address addr, PhysicalAddress phys_addr)
java.lang.Object
down(Event evt)
An event is to be sent down the stack.Responses
findMembers(java.util.List<Address> members, boolean initial_discovery, boolean async, long timeout)
void
findMembers(java.util.List<Address> members, boolean initial_discovery, Responses responses)
Fetches information (e.g.static int
getDiscoveryCacheSize()
void
handleConnect()
void
handleDisconnect()
boolean
isDynamic()
static java.lang.String
print()
void
stop()
This method is called on aJChannel.disconnect()
.java.lang.String
toString()
-
Methods inherited from class org.jgroups.protocols.Discovery
addDiscoveryResponseToCaches, addResponse, addResponse, addressAsString, addToCache, breakOnCoordResponse, breakOnCoordResponse, clearRequestFutures, deserialize, discoveryRequestReceived, discoveryRspExpiryTime, disseminateDiscoveryInformation, dumpCache, findInitialMembersAsString, getClusterName, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handleDiscoveryResponse, init, invokeFindMembers, isCoord, isMergeRunning, marshal, providedUpServices, read, readPingData, resetStats, returnEntireCache, returnEntireCache, sendCacheInformation, sendDiscoveryResponse, serializeWithoutView, setClusterName, staggerTimeout, staggerTimeout, start, startCacheDissemination, up, up, useDiskCache, useDiskCache, weedOutCompletedDiscoveryResponses, write
-
Methods inherited from class org.jgroups.stack.Protocol
accept, afterCreationHook, destroy, down, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, providedDownServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, up
-
-
-
-
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:Protocol
This method is called on aJChannel.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
-
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 classDiscovery
-
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 theResponses
object. IfDiscovery.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 classDiscovery
- Parameters:
members
- A list of logical addresses (typicallyUUID
s). 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: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 usingdown_prot.down()
.
-
handleConnect
public void handleConnect()
- Overrides:
handleConnect
in classDiscovery
-
handleDisconnect
public void handleDisconnect()
- Overrides:
handleDisconnect
in classDiscovery
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
addAddressToLocalCache
protected void addAddressToLocalCache(Address addr, PhysicalAddress phys_addr)
-
-