Package org.jgroups.protocols
Class TCPPING
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.Discovery
-
- org.jgroups.protocols.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.DiscoveryCacheDisseminationTask
-
-
Field Summary
Fields Modifier and Type Field Description protected intdefault_portprotected BoundedList<PhysicalAddress>dynamic_hostshttps://issues.redhat.com/browse/JGRP-989protected java.util.Collection<PhysicalAddress>initial_hostsprotected java.lang.Stringinitial_hosts_fileprotected booleaninitial_hosts_set_programmaticallyprotected java.lang.Stringinitial_hosts_strprotected intmax_dynamic_hostsprotected intport_rangeprotected StackTypestack_typeprotected java.util.Collection<java.lang.String>unresolved_hosts-
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 TCPPING()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends TCPPING>
TclearDynamicHostList()voiddiscoveryRequestReceived(Address sender, java.lang.String logical_name, PhysicalAddress physical_addr)java.lang.Objectdown(Event evt)An event is to be sent down the stack.voidfindMembers(java.util.List<Address> members, boolean initial_discovery, Responses responses)Fetches information (e.g.java.lang.StringgetDynamicHostList()java.util.Collection<PhysicalAddress>getInitialHosts()Returns the list of initial hosts as configured by the user via XML.intgetPortRange()java.util.Collection<PhysicalAddress>getResolvedHosts()protected static java.lang.StringhostsToStr(java.util.Collection<PhysicalAddress> hosts)voidinit()Called after a protocol has been created and before the protocol is started.<T extends TCPPING>
TinitialHosts(java.util.Collection<java.net.InetSocketAddress> h)booleanisDynamic()<T extends TCPPING>
TportRange(int r)protected voidsendDiscoveryRequest(Message req)<T extends TCPPING>
TsetInitialHosts(java.util.Collection<java.net.InetSocketAddress> hosts)<T extends TCPPING>
TsetInitialHosts2(java.util.Collection<PhysicalAddress> hosts)<T extends TCPPING>
TsetPortRange(int port_range)-
Methods inherited from class org.jgroups.protocols.Discovery
addDiscoveryResponseToCaches, addResponse, addResponse, addressAsString, addToCache, breakOnCoordResponse, breakOnCoordResponse, callFindMembersInAllDiscoveryProtocols, clearRequestFutures, deserialize, discoveryRspExpiryTime, disseminateDiscoveryInformation, dumpCache, findInitialMembersAsString, findMembers, findTopmostDiscoveryProtocol, getClusterName, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handle, handleConnect, handleDisconnect, handleDiscoveryResponse, handleDiscoveryResponse, isCoord, isMergeRunning, marshal, marshal, marshal, print, providedUpServices, read, readPingData, resetStats, returnEntireCache, returnEntireCache, sendCacheInformation, sendCacheOnJoin, sendCacheOnJoin, sendDiscoveryResponse, sendDiscoveryResponse, serializeWithoutView, setClusterName, staggerTimeout, staggerTimeout, start, startCacheDissemination, stop, 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
-
initial_hosts_str
protected java.lang.String initial_hosts_str
-
initial_hosts_file
protected java.lang.String initial_hosts_file
-
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
-
dynamic_hosts
protected BoundedList<PhysicalAddress> dynamic_hosts
https://issues.redhat.com/browse/JGRP-989
-
default_port
protected int default_port
-
stack_type
protected StackType stack_type
-
-
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.ExceptionDescription copied from class:ProtocolCalled 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.
-
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().
-
discoveryRequestReceived
public void discoveryRequestReceived(Address sender, java.lang.String logical_name, PhysicalAddress physical_addr)
- Overrides:
discoveryRequestReceivedin 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
-
sendDiscoveryRequest
protected void sendDiscoveryRequest(Message req)
-
hostsToStr
protected static java.lang.String hostsToStr(java.util.Collection<PhysicalAddress> hosts)
-
-