|
|||||||||||
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.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 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: 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
Field Summary |
Fields inherited from class org.jgroups.stack.Protocol |
down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, up_handler, up_prot, up_queue, up_thread, up_thread_prio |
Constructor Summary | |
PING()
|
Method Summary | |
void |
down(Event evt)
An event is to be sent down the stack. |
java.lang.String |
getName()
|
java.util.Vector |
providedUpServices()
List of events that are provided to layers above (they will be handled when sent down from above). |
boolean |
setProperties(java.util.Properties props)
sets the properties of the PING protocol. |
void |
stop()
This method is called on a Channel.disconnect() . |
void |
up(Event evt)
An event was received from the layer below. |
Methods inherited from class org.jgroups.stack.Protocol |
destroy, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, passDown, passUp, providedDownServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setUpProtocol, start, startDownHandler, startUpHandler, stopInternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PING()
Method Detail |
public java.lang.String getName()
getName
in class Protocol
public java.util.Vector providedUpServices()
Protocol
providedUpServices
in class Protocol
public boolean setProperties(java.util.Properties props)
setProperties
in class Protocol
props
- - a property set containing only PING properties
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 flushed
stop
in class Protocol
public void up(Event evt)
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 above
up
in class Protocol
evt
- - the event that has been sent from the layer belowpublic void down(Event evt)
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 PassUp
.
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.
down
in class Protocol
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |