|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.PING
public class PING
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 GossipRouter). 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 GossipRouter, default is null property: gossip_port - if you are using GOSSIP then this defines the port of the GossipRouter, default is null
| Field Summary | |
|---|---|
protected Promise<java.lang.Boolean> |
discovery_reception
|
static java.lang.String |
name
|
| Fields inherited from class org.jgroups.stack.Protocol |
|---|
down_prot, log, props, stack, stats, up_prot |
| Constructor Summary | |
|---|---|
PING()
|
|
| Method Summary | |
|---|---|
int |
getGossipPort()
|
long |
getGossipRefresh()
|
java.lang.String |
getName()
|
void |
handleConnect()
|
void |
handleDisconnect()
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
void |
localAddressSet(Address addr)
Called after local_addr was set |
void |
sendGetMembersRequest()
|
void |
setGossipPort(int gossip_port)
|
void |
setGossipRefresh(long gossip_refresh)
|
boolean |
setProperties(java.util.Properties props)
sets the properties of the PING protocol. |
void |
stop()
This method is called on a Channel.disconnect(). |
java.lang.Object |
up(Event evt)
An event was received from the layer below. |
protected void |
waitForDiscoveryRequestReception()
|
| Methods inherited from class org.jgroups.protocols.Discovery |
|---|
down, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, start |
| Methods inherited from class org.jgroups.stack.Protocol |
|---|
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Promise<java.lang.Boolean> discovery_reception
public static final java.lang.String name
| Constructor Detail |
|---|
public PING()
| Method Detail |
|---|
public java.lang.String getName()
getName in class Protocolpublic boolean setProperties(java.util.Properties props)
setProperties in class Discoveryprops - - a property set containing only PING properties
public int getGossipPort()
public void setGossipPort(int gossip_port)
public long getGossipRefresh()
public void setGossipRefresh(long gossip_refresh)
public void init()
throws java.lang.Exception
Protocol
init in class Discoveryjava.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic void stop()
ProtocolChannel.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
stop in class Discoverypublic void localAddressSet(Address addr)
Discovery
localAddressSet in class Discoverypublic void handleConnect()
handleConnect in class Discoverypublic void handleDisconnect()
handleDisconnect in class Discoverypublic void sendGetMembersRequest()
sendGetMembersRequest in class Discoverypublic java.lang.Object up(Event evt)
DiscoveryPassDown or c) the event (or another event) is sent up
the stack using PassUp.
For the PING protocol, the Up operation does the following things.
1. If the event is a Event.MSG then PING will inspect the message header.
If the header is null, PING simply passes up the event
If the header is PingHeader.GET_MBRS_REQ then the PING protocol
will PassDown a PingRequest message
If the header is PingHeader.GET_MBRS_RSP we will add the message to the initial members
vector and wake up any waiting threads.
2. If the event is Event.SET_LOCAL_ADDR we will simple set the local address of this protocol
3. For all other messages we simple pass it up to the protocol above
up in class Discoveryevt - - the event that has been sent from the layer belowprotected void waitForDiscoveryRequestReception()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||