| java.lang.Object java.lang.Thread org.jgroups.stack.UpHandler org.jgroups.protocols.pbcast.GMS
GMS | public class GMS extends Protocol (Code) | | 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
author: Bela Ban version: $Id: GMS.java,v 1.68.2.5 2007/04/27 08:03:55 belaban Exp $ |
Inner Class :public static class Request | |
Inner Class :class ViewHandler implements Runnable | |
Constructor Summary | |
public | GMS() |
Method Summary | |
public void | becomeClient() | public void | becomeCoordinator() | public void | becomeParticipant() | public void | castViewChange(Vector new_mbrs, Vector old_mbrs, Vector suspected_mbrs) Compute a new view, given the current view, the new members and the suspected/left
members. | public void | castViewChange(View new_view, Digest digest) | public 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(Vector mbrs) | protected Address | determineCoordinator() | public void | down(Event evt) | public String | dumpViewHandlerHistory() | public String | dumpViewHandlerQueue() | public Digest | getDigest() | public GmsImpl | getImpl() | public long | getJoinRetryTimeout() | public long | getJoinTimeout() | public String | getLocalAddress() | Log | getLog() | public String | getMembers() | public String | getName() | public View | getNextView(Collection new_mbrs, Collection old_mbrs, Collection suspected_mbrs) Computes the next view. | public int | getNumMembers() | public int | getNumberOfViews() | public String | getView() | ViewHandler | getViewHandler() | boolean | haveCoordinatorRole() | public void | init() | final void | initState() | public void | installView(View new_view, Digest digest) Sets the new view and sends a VIEW_CHANGE event up and down the stack. | public void | installView(View new_view) Sets the new view and sends a VIEW_CHANGE event up and down the stack. | public boolean | isCoordinator() | public boolean | isShun() | public boolean | isViewHandlerSuspended() | public View | makeView(Vector mbrs) | public View | makeView(Vector mbrs, ViewId vid) | public void | mergeDigest(Digest d) | public String | printPreviousMembers() | public String | printPreviousViews() | public 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. | public Vector | requiredDownServices() | public void | resetStats() | public void | resumeViewHandler() | public void | setDigest(Digest d) | public void | setImpl(GmsImpl new_impl) | public void | setJoinRetryTimeout(long t) | public void | setJoinTimeout(long t) | public boolean | setProperties(Properties props) | public void | setShun(boolean s) | public void | start() | boolean | startFlush(View new_view, int numberOfAttempts) | public void | stop() | void | stopFlush(View view) | public void | suspendViewHandler() | public void | up(Event evt) | public int | viewHandlerSize() | protected boolean | wouldBeNewCoordinator(Address potential_new_coord) |
disable_initial_coord | boolean disable_initial_coord(Code) | | |
flushProtocolInStack | boolean flushProtocolInStack(Code) | | |
flush_timeout | long flush_timeout(Code) | | |
handle_concurrent_startup | boolean handle_concurrent_startup(Code) | | Setting this to false disables concurrent startups. This is only used by unit testing code
for testing merging. To everybody else: don't change it to false !
|
join_retry_timeout | long join_retry_timeout(Code) | | |
join_timeout | long join_timeout(Code) | | |
leave_timeout | long leave_timeout(Code) | | |
merge_leader | boolean merge_leader(Code) | | |
merge_timeout | long merge_timeout(Code) | | |
num_prev_mbrs | protected int num_prev_mbrs(Code) | | Max number of old members to keep in history
|
prev_members | BoundedList prev_members(Code) | | Keeps track of old members (up to num_prev_mbrs)
|
resume_task_timeout | long resume_task_timeout(Code) | | How long should a Resumer wait until resuming the ViewHandler
|
use_flush | boolean use_flush(Code) | | |
view_ack_collection_timeout | long view_ack_collection_timeout(Code) | | Time in ms to wait for all VIEW acks (0 == wait forever)
|
becomeClient | public void becomeClient()(Code) | | |
becomeCoordinator | public void becomeCoordinator()(Code) | | |
becomeParticipant | public void becomeParticipant()(Code) | | |
castViewChange | public void castViewChange(Vector new_mbrs, Vector old_mbrs, Vector suspected_mbrs)(Code) | | Compute a new view, given the current view, the new members and the suspected/left
members. Then simply mcast the view to all members. This is different to the VS GMS protocol,
in which we run a FLUSH protocol which tries to achive consensus on the set of messages mcast in
the current view before proceeding to install the next view.
The members for the new view are computed as follows:
existing leaving suspected joining
1. new_view y n n y
2. tmp_view y y n y
(view_dest)
-
The new view to be installed includes the existing members plus the joining ones and
excludes the leaving and suspected members.
-
A temporary view is sent down the stack as an event. This allows the bottom layer
(e.g. UDP or TCP) to determine the members to which to send a multicast message. Compared
to the new view, leaving members are included since they have are waiting for a
view in which they are not members any longer before they leave. So, if we did not set a
temporary view, joining members would not receive the view (signalling that they have been
joined successfully). The temporary view is essentially the current view plus the joining
members (old members are still part of the current view).
|
castViewChangeWithDest | public void castViewChangeWithDest(View new_view, Digest digest, java.util.List members)(Code) | | Broadcasts the new view and digest, and waits for acks from all members in the list given as argument.
If the list is null, we take the members who are part of new_view
Parameters: new_view - Parameters: digest - Parameters: members - |
checkSelfInclusion | protected boolean checkSelfInclusion(Vector mbrs)(Code) | | Returns true if local_addr is member of mbrs, else false
|
determineCoordinator | protected Address determineCoordinator()(Code) | | |
dumpViewHandlerHistory | public String dumpViewHandlerHistory()(Code) | | |
dumpViewHandlerQueue | public String dumpViewHandlerQueue()(Code) | | |
getDigest | public Digest getDigest()(Code) | | Sends down a GET_DIGEST event and waits for the GET_DIGEST_OK response, or
timeout, whichever occurs first
|
getJoinRetryTimeout | public long getJoinRetryTimeout()(Code) | | |
getJoinTimeout | public long getJoinTimeout()(Code) | | |
getNextView | public View getNextView(Collection new_mbrs, Collection old_mbrs, Collection suspected_mbrs)(Code) | | Computes the next view. Returns a copy that has old_mbrs and
suspected_mbrs removed and new_mbrs added.
|
getNumMembers | public int getNumMembers()(Code) | | |
getNumberOfViews | public int getNumberOfViews()(Code) | | |
getViewHandler | ViewHandler getViewHandler()(Code) | | |
haveCoordinatorRole | boolean haveCoordinatorRole()(Code) | | |
initState | final void initState()(Code) | | |
installView | public void installView(View new_view, Digest digest)(Code) | | Sets the new view and sends a VIEW_CHANGE event up and down the stack. If the view is a MergeView (subclass
of View), then digest will be non-null and has to be set before installing the view.
|
installView | public void installView(View new_view)(Code) | | Sets the new view and sends a VIEW_CHANGE event up and down the stack.
|
isCoordinator | public boolean isCoordinator()(Code) | | |
isShun | public boolean isShun()(Code) | | |
isViewHandlerSuspended | public boolean isViewHandlerSuspended()(Code) | | |
mergeDigest | public void mergeDigest(Digest d)(Code) | | Send down a MERGE_DIGEST event
|
printPreviousMembers | public String printPreviousMembers()(Code) | | |
receiveUpEvent | public void receiveUpEvent(Event evt)(Code) | | 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. It therefore sends down a GET_DIGEST event, to which the NAKACK layer
responds with a GET_DIGEST_OK event.
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.
|
requiredDownServices | public Vector requiredDownServices()(Code) | | |
resetStats | public void resetStats()(Code) | | |
resumeViewHandler | public void resumeViewHandler()(Code) | | |
setDigest | public void setDigest(Digest d)(Code) | | Send down a SET_DIGEST event
|
setJoinRetryTimeout | public void setJoinRetryTimeout(long t)(Code) | | |
setJoinTimeout | public void setJoinTimeout(long t)(Code) | | |
setProperties | public boolean setProperties(Properties props)(Code) | | Setup the Protocol instance according to the configuration string
|
setShun | public void setShun(boolean s)(Code) | | |
startFlush | boolean startFlush(View new_view, int numberOfAttempts)(Code) | | |
suspendViewHandler | public void suspendViewHandler()(Code) | | |
viewHandlerSize | public int viewHandlerSize()(Code) | | |
wouldBeNewCoordinator | protected boolean wouldBeNewCoordinator(Address potential_new_coord)(Code) | | Checks whether the potential_new_coord would be the new coordinator (2nd in line)
|
Fields inherited from org.jgroups.stack.UpHandler | final protected Log log(Code)(Java Doc)
|
|
|