org.jgroups.protocols

Class PING

Known Direct 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 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

Method Summary

String
getName()
void
handleConnect()
void
handleDisconnect()
void
localAddressSet(Address addr)
void
sendGetMembersRequest()
boolean
setProperties(Properties props)
sets the properties of the PING protocol.
void
stop()

Methods inherited from class org.jgroups.protocols.Discovery

down, findInitialMembers, findInitialMembersAsString, getNumInitialMembers, getNumPingRequests, getNumberOfDiscoveryRequestsSent, getTimeout, handleConnect, handleConnectOK, handleDisconnect, localAddressSet, makeView, providedUpServices, resetStats, sendGetMembersRequest, setNumInitialMembers, setNumPingRequests, setProperties, setTimeout, start, stop, up

Methods inherited from class org.jgroups.stack.Protocol

destroy, down, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getDownQueue, getName, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setObserver, setProperties, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, start, startDownHandler, startUpHandler, statsEnabled, stop, stopInternal, up, upThreadEnabled

Field Details

name

public static final String name

Method Details

getName

public String getName()
Overrides:
getName in interface Protocol

handleConnect

public void handleConnect()
Overrides:
handleConnect in interface Discovery

handleDisconnect

public void handleDisconnect()
Overrides:
handleDisconnect in interface Discovery

localAddressSet

public void localAddressSet(Address addr)
Overrides:
localAddressSet in interface Discovery

sendGetMembersRequest

public void sendGetMembersRequest()
Overrides:
sendGetMembersRequest in interface Discovery

setProperties

public boolean setProperties(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 interface 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()
Overrides:
stop in interface Discovery

Copyright B) 1998-2005 Bela Ban. All Rights Reserved.