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 layer retrieves the initial membership in answer to the
GMS's FIND_INITIAL_MBRS event. The initial membership is retrieved by
directly contacting other group members, sending point-to-point membership
requests. The responses should allow us to determine the coordinator whom we
have to contact in case we want to join the group. When we are a server
(after having received the BECOME_SERVER event), we'll respond to TCPPING
requests with a TCPPING response.
The FIND_INITIAL_MBRS event will eventually be answered with a
FIND_INITIAL_MBRS_OK event up the stack.
The TCPPING protocol requires a static configuration, which assumes that you
to know in advance where to find other members of your group. For dynamic
discovery, use the PING protocol, which uses multicast discovery, or the
TCPGOSSIP protocol, which contacts a Gossip Router to acquire the initial
membership.
- Author:
- Bela Ban
Methods inherited from class org.jgroups.protocols.Discovery |
findAllMembers, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, getView, handleConnect, handleDisconnect, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, stop, up |
Methods inherited from class org.jgroups.stack.Protocol |
destroy, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
max_dynamic_hosts
protected int max_dynamic_hosts
dynamic_hosts
protected final BoundedList<PhysicalAddress> dynamic_hosts
- https://jira.jboss.org/jira/browse/JGRP-989
TCPPING
public TCPPING()
getInitialHosts
public java.util.List<IpAddress> 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
setInitialHosts
public void setInitialHosts(java.util.List<IpAddress> initial_hosts)
getPortRange
public int getPortRange()
setPortRange
public void setPortRange(int port_range)
getDynamicHostList
public java.lang.String getDynamicHostList()
getInitialHostsList
public java.lang.String getInitialHostsList()
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.
- Overrides:
init
in class Discovery
- Throws:
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exception
start
public void start()
throws java.lang.Exception
- Description copied from class:
Protocol
- This method is called on a
Channel.connect(String)
. Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.
- Overrides:
start
in class Discovery
- Throws:
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exception
sendGetMembersRequest
public void sendGetMembersRequest(java.lang.String cluster_name,
Promise promise,
boolean return_views_only)
throws java.lang.Exception
- Specified by:
sendGetMembersRequest
in class Discovery
- Throws:
java.lang.Exception
down
public java.lang.Object down(Event evt)
- Description copied from class:
Discovery
- An event is to be sent down the stack. The layer 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 layer may need to add a header to it (or do nothing at all) before sending it down
the stack using
PassDown
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.
The PING protocol is interested in several different down events,
Event.FIND_INITIAL_MBRS - sent by the GMS layer and expecting a GET_MBRS_OK
Event.TMP_VIEW and Event.VIEW_CHANGE - a view change event
Event.BECOME_SERVER - called after client has joined and is fully working group member
Event.CONNECT, Event.DISCONNECT.
- Overrides:
down
in class Discovery
discoveryRequestReceived
public void discoveryRequestReceived(Address sender,
java.lang.String logical_name,
java.util.Collection<PhysicalAddress> physical_addrs)
- Overrides:
discoveryRequestReceived
in class Discovery
Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.