Package org.jgroups.protocols
Class TCPPING
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.Discovery
-
- org.jgroups.protocols.TCPPING
-
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 BoundedList<PhysicalAddress>
dynamic_hosts
https://jira.jboss.org/jira/browse/JGRP-989protected java.util.Collection<PhysicalAddress>
initial_hosts
protected boolean
initial_hosts_set_programmatically
protected java.lang.String
initial_hosts_str
protected int
max_dynamic_hosts
protected int
port_range
protected 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, 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 TCPPING()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends TCPPING>
TclearDynamicHostList()
void
discoveryRequestReceived(Address sender, java.lang.String logical_name, PhysicalAddress physical_addr)
java.lang.Object
down(Event evt)
An event is to be sent down the stack.void
findMembers(java.util.List<Address> members, boolean initial_discovery, Responses responses)
Fetches information (e.g.java.lang.String
getDynamicHostList()
java.util.Collection<PhysicalAddress>
getInitialHosts()
Returns the list of initial hosts as configured by the user via XML.int
getPortRange()
java.util.Collection<PhysicalAddress>
getResolvedHosts()
protected static java.lang.String
hostsToStr(java.util.Collection<PhysicalAddress> hosts)
void
init()
Called after instance has been created (null constructor) and before protocol is started.<T extends TCPPING>
TinitialHosts(java.util.Collection<java.net.InetSocketAddress> h)
boolean
isDynamic()
<T extends TCPPING>
TportRange(int r)
protected void
sendDiscoveryRequest(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, clearRequestFutures, deserialize, discoveryRspExpiryTime, disseminateDiscoveryInformation, dumpCache, findInitialMembersAsString, findMembers, getClusterName, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handleConnect, handleDisconnect, handleDiscoveryResponse, invokeFindMembers, isCoord, isMergeRunning, marshal, providedUpServices, read, readPingData, resetStats, returnEntireCache, returnEntireCache, sendCacheInformation, sendDiscoveryResponse, serializeWithoutView, setClusterName, staggerTimeout, staggerTimeout, start, startCacheDissemination, stop, 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
-
initial_hosts_str
protected java.lang.String initial_hosts_str
-
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://jira.jboss.org/jira/browse/JGRP-989
-
-
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.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.
-
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()
.
-
discoveryRequestReceived
public void discoveryRequestReceived(Address sender, java.lang.String logical_name, PhysicalAddress physical_addr)
- Overrides:
discoveryRequestReceived
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
-
sendDiscoveryRequest
protected void sendDiscoveryRequest(Message req)
-
hostsToStr
protected static java.lang.String hostsToStr(java.util.Collection<PhysicalAddress> hosts)
-
-