public class PING extends Discovery
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
Modifier and Type | Field and Description |
---|---|
protected Promise<java.lang.Boolean> |
discovery_reception |
static java.lang.String |
name |
Constructor and Description |
---|
PING() |
Modifier and Type | Method and Description |
---|---|
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() |
down, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, start
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled
protected final Promise<java.lang.Boolean> discovery_reception
public static final java.lang.String name
public boolean setProperties(java.util.Properties props)
setProperties
in class Discovery
props
- - a property set containing only PING propertiespublic 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
public void stop()
Protocol
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 flushedpublic void localAddressSet(Address addr)
Discovery
localAddressSet
in class Discovery
public void handleConnect()
handleConnect
in class Discovery
public void handleDisconnect()
handleDisconnect
in class Discovery
public void sendGetMembersRequest()
sendGetMembersRequest
in class Discovery
public java.lang.Object up(Event evt)
Discovery
PassDown
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 aboveprotected void waitForDiscoveryRequestReception()
Copyright ? 1998-2008 Bela Ban. All Rights Reserved.