org.jgroups.protocols
Class PING
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.PING
- Direct Known Subclasses:
- MPING
- public class PING
- extends Discovery
The PING protocol layer retrieves the initial membership (used by the GMS when started
by sending event FIND_INITIAL_MBRS down the stack). We do this by mcasting PING
requests to an IP MCAST address (or, if gossiping is enabled, by contacting the GossipServer).
The responses should allow us to determine the coordinator whom we have to
contact, e.g. in case we want to join the group. When we are a server (after having
received the BECOME_SERVER event), we'll respond to PING requests with a PING
response.
The FIND_INITIAL_MBRS event will eventually be answered with a
FIND_INITIAL_MBRS_OK event up the stack.
The following properties are available
property: gossip_host - if you are using GOSSIP then this defines the host of the GossipServer, default is null
property: gossip_port - if you are using GOSSIP then this defines the port of the GossipServer, default is null
Field Summary |
static java.lang.String |
name
|
Fields inherited from class org.jgroups.stack.Protocol |
down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, trace, up_handler, up_prot, up_queue, up_thread, up_thread_prio, warn |
Constructor Summary |
PING()
|
Methods inherited from class org.jgroups.protocols.Discovery |
down, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, handleConnectOK, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, start, up |
Methods inherited from class org.jgroups.stack.Protocol |
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, startDownHandler, startUpHandler, statsEnabled, stopInternal, upThreadEnabled |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
name
public static final java.lang.String name
- See Also:
- Constant Field Values
PING
public PING()
getName
public java.lang.String getName()
- Specified by:
getName
in class Protocol
setProperties
public boolean setProperties(java.util.Properties props)
- sets the properties of the PING protocol.
The following properties are available
property: timeout - the timeout (ms) to wait for the initial members, default is 3000=3 secs
property: num_initial_members - the minimum number of initial members for a FIND_INITAL_MBRS, default is 2
property: gossip_host - if you are using GOSSIP then this defines the host of the GossipServer, default is null
property: gossip_port - if you are using GOSSIP then this defines the port of the GossipServer, default is null
- Overrides:
setProperties
in class Discovery
- Parameters:
props
- - a property set containing only PING properties
- Returns:
- returns true if all properties were parsed properly
returns false if there are unrecnogized properties in the property set
stop
public void stop()
- Description copied from class:
Protocol
- This method is called on a
Channel.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
- Overrides:
stop
in class Discovery
localAddressSet
public void localAddressSet(Address addr)
- Description copied from class:
Discovery
- Called after local_addr was set
- Overrides:
localAddressSet
in class Discovery
handleConnect
public void handleConnect()
- Overrides:
handleConnect
in class Discovery
handleDisconnect
public void handleDisconnect()
- Overrides:
handleDisconnect
in class Discovery
sendGetMembersRequest
public void sendGetMembersRequest()
- Specified by:
sendGetMembersRequest
in class Discovery
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.