|
||||||||||
| 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.pbcast.GMS
public class GMS
Group membership protocol. Handles joins/leaves/crashes (suspicions) and emits new views accordingly. Use VIEW_ENFORCER on top of this layer to make sure new members don't receive any messages until they are members.
| Nested Class Summary | |
|---|---|
static class |
GMS.GmsHeader
|
static class |
GMS.Request
|
| Field Summary | |
|---|---|
protected int |
num_prev_mbrs
Max number of old members to keep in history |
org.jgroups.protocols.pbcast.GMS.ViewHandler |
view_handler
Class to process JOIN, LEAVE and MERGE requests |
| 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 | |
|---|---|
GMS()
|
|
| Method Summary | |
|---|---|
void |
becomeClient()
|
void |
becomeCoordinator()
|
void |
becomeParticipant()
|
void |
castViewChange(java.util.Vector new_mbrs,
java.util.Vector old_mbrs,
java.util.Vector suspected_mbrs)
Compute a new view, given the current view, the new members and the suspected/left members. |
void |
castViewChange(View new_view,
Digest digest)
|
void |
castViewChangeWithDest(View new_view,
Digest digest,
java.util.List members)
Broadcasts the new view and digest, and waits for acks from all members in the list given as argument. |
protected boolean |
checkSelfInclusion(java.util.Vector mbrs)
Returns true if local_addr is member of mbrs, else false |
protected Address |
determineCoordinator()
|
void |
down(Event evt)
An event is to be sent down the stack. |
java.lang.String |
dumpViewHandlerHistory()
|
java.lang.String |
dumpViewHandlerQueue()
|
Digest |
getDigest()
Sends down a GET_DIGEST event and waits for the GET_DIGEST_OK response, or timeout, whichever occurs first |
GmsImpl |
getImpl()
|
long |
getJoinRetryTimeout()
|
long |
getJoinTimeout()
|
java.lang.String |
getLocalAddress()
|
java.lang.String |
getMembers()
|
java.lang.String |
getName()
|
View |
getNextView(java.util.Vector new_mbrs,
java.util.Vector old_mbrs,
java.util.Vector suspected_mbrs)
Computes the next view. |
int |
getNumberOfViews()
|
int |
getNumMembers()
|
java.lang.String |
getView()
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
void |
installView(View new_view)
Sets the new view and sends a VIEW_CHANGE event up and down the stack. |
void |
installView(View new_view,
Digest digest)
Sets the new view and sends a VIEW_CHANGE event up and down the stack. |
boolean |
isCoordinator()
|
boolean |
isShun()
|
boolean |
isViewHandlerSuspended()
|
View |
makeView(java.util.Vector mbrs)
|
View |
makeView(java.util.Vector mbrs,
ViewId vid)
|
void |
mergeDigest(Digest d)
Send down a MERGE_DIGEST event |
java.lang.String |
printPreviousMembers()
|
java.lang.String |
printPreviousViews()
|
void |
receiveUpEvent(Event evt)
This method is overridden to avoid hanging on getDigest(): when a JOIN is received, the coordinator needs to retrieve the digest from the NAKACK layer. |
java.util.Vector |
requiredDownServices()
List of events that are required to be answered by some layer below. |
void |
resetStats()
|
void |
resumeViewHandler()
|
void |
setDigest(Digest d)
Send down a SET_DIGEST event |
void |
setImpl(GmsImpl new_impl)
|
void |
setJoinRetryTimeout(long t)
|
void |
setJoinTimeout(long t)
|
boolean |
setProperties(java.util.Properties props)
Setup the Protocol instance according to the configuration string |
void |
setShun(boolean s)
|
void |
start()
This method is called on a Channel.connect(String). |
void |
stop()
This method is called on a Channel.disconnect(). |
void |
suspendViewHandler()
|
void |
up(Event evt)
An event was received from the layer below. |
int |
viewHandlerSize()
|
protected boolean |
wouldBeNewCoordinator(Address potential_new_coord)
Checks whether the potential_new_coord would be the new coordinator (2nd in line) |
| Methods inherited from class org.jgroups.stack.Protocol |
|---|
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, 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 |
| Field Detail |
|---|
protected int num_prev_mbrs
public final org.jgroups.protocols.pbcast.GMS.ViewHandler view_handler
| Constructor Detail |
|---|
public GMS()
| Method Detail |
|---|
public java.lang.String getName()
getName in class Protocolpublic java.lang.String getView()
public int getNumberOfViews()
public java.lang.String getLocalAddress()
public java.lang.String getMembers()
public int getNumMembers()
public long getJoinTimeout()
public void setJoinTimeout(long t)
public long getJoinRetryTimeout()
public void setJoinRetryTimeout(long t)
public boolean isShun()
public void setShun(boolean s)
public java.lang.String printPreviousMembers()
public int viewHandlerSize()
public boolean isViewHandlerSuspended()
public java.lang.String dumpViewHandlerQueue()
public java.lang.String dumpViewHandlerHistory()
public void suspendViewHandler()
public void resumeViewHandler()
public java.lang.String printPreviousViews()
public boolean isCoordinator()
public void resetStats()
resetStats in class Protocolpublic java.util.Vector requiredDownServices()
Protocol
requiredDownServices in class Protocolpublic void setImpl(GmsImpl new_impl)
public GmsImpl getImpl()
public void init()
throws java.lang.Exception
Protocol
init in class Protocoljava.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exception
public void start()
throws java.lang.Exception
ProtocolChannel.connect(String). Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.
start in class Protocoljava.lang.Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String) 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 Protocolpublic void becomeCoordinator()
public void becomeParticipant()
public void becomeClient()
public View getNextView(java.util.Vector new_mbrs,
java.util.Vector old_mbrs,
java.util.Vector suspected_mbrs)
old_mbrs and
suspected_mbrs removed and new_mbrs added.
public void castViewChange(java.util.Vector new_mbrs,
java.util.Vector old_mbrs,
java.util.Vector suspected_mbrs)
existing leaving suspected joining
1. new_view y n n y
2. tmp_view y y n y
(view_dest)
public void castViewChange(View new_view,
Digest digest)
public void castViewChangeWithDest(View new_view,
Digest digest,
java.util.List members)
new_view - digest - members -
public void installView(View new_view,
Digest digest)
public void installView(View new_view)
protected Address determineCoordinator()
protected boolean wouldBeNewCoordinator(Address potential_new_coord)
protected boolean checkSelfInclusion(java.util.Vector mbrs)
public View makeView(java.util.Vector mbrs)
public View makeView(java.util.Vector mbrs,
ViewId vid)
public void setDigest(Digest d)
public void mergeDigest(Digest d)
public Digest getDigest()
public void up(Event evt)
ProtocolpassDown() or c) the event (or another event) is sent up
the stack using passUp().
up in class Protocolpublic void receiveUpEvent(Event evt)
However, the GET_DIGEST_OK event will not be processed because the thread handling the JOIN request won't process the GET_DIGEST_OK event until the JOIN event returns. The receiveUpEvent() method is executed by the up-handler thread of the lower protocol and therefore can handle the event. All we do here is unblock the mutex on which JOIN is waiting, allowing JOIN to return with a valid digest. The GET_DIGEST_OK event is then discarded, because it won't be processed twice.
receiveUpEvent in class Protocolpublic void down(Event evt)
ProtocolpassDown(). 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().
down in class Protocolpublic boolean setProperties(java.util.Properties props)
setProperties in class Protocol
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||