public class GMS extends Protocol
Modifier and Type | Class | Description |
---|---|---|
static class |
GMS.GmsHeader |
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
name |
|
protected int |
num_prev_mbrs |
Max number of old members to keep in history
|
Constructor | Description |
---|---|
GMS() |
Modifier and Type | Method | Description |
---|---|---|
void |
becomeClient() |
|
void |
becomeCoordinator() |
|
void |
becomeParticipant() |
|
void |
castViewChangeWithDest(View new_view,
Digest digest,
JoinRsp jr,
java.util.Collection<Address> newMembers) |
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<Address> mbrs) |
Returns true if local_addr is member of mbrs, else false
|
protected Address |
determineCoordinator() |
|
java.lang.Object |
down(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.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() |
Deprecated.
|
long |
getJoinTimeout() |
|
java.lang.String |
getLocalAddress() |
|
long |
getMaxBundlingTime() |
|
java.lang.String |
getMembers() |
|
java.lang.String |
getName() |
|
View |
getNextView(java.util.Collection<Address> new_mbrs,
java.util.Collection<Address> old_mbrs,
java.util.Collection<Address> suspected_mbrs) |
Computes the next view.
|
int |
getNumberOfViews() |
|
int |
getNumMembers() |
|
java.lang.String |
getView() |
|
long |
getViewAckCollectionTimeout() |
|
void |
init() |
Called after instance has been created (null constructor) and before protocol is started.
|
void |
installView(View new_view) |
|
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 |
isPrintLocalAddr() |
|
boolean |
isShun() |
|
boolean |
isViewBundling() |
|
boolean |
isViewHandlerSuspended() |
|
View |
makeView(java.util.Vector<Address> mbrs) |
|
static View |
makeView(java.util.Vector<Address> mbrs,
ViewId vid) |
|
void |
mergeDigest(Digest d) |
Send down a MERGE_DIGEST event
|
java.lang.String |
printPreviousMembers() |
|
java.lang.String |
printPreviousViews() |
|
java.util.Vector<java.lang.Integer> |
requiredDownServices() |
List of events that are required to be answered by some layer below.
|
void |
resetStats() |
|
void |
resumeViewHandler() |
|
void |
sendJoinResponse(JoinRsp rsp,
Address dest) |
|
void |
setDigest(Digest d) |
Send down a SET_DIGEST event
|
void |
setImpl(GmsImpl new_impl) |
|
void |
setJoinRetryTimeout(long t) |
Deprecated.
|
void |
setJoinTimeout(long t) |
|
void |
setMaxBundlingTime(long max_bundling_time) |
|
void |
setPrintLocalAddr(boolean print_local_addr) |
|
boolean |
setProperties(java.util.Properties props) |
Setup the Protocol instance according to the configuration string
|
void |
setShun(boolean s) |
|
void |
setViewAckCollectionTimeout(long view_ack_collection_timeout) |
|
void |
setViewBundling(boolean view_bundling) |
|
void |
start() |
This method is called on a
Channel.connect(String) . |
void |
stop() |
This method is called on a
Channel.disconnect() . |
void |
suspendViewHandler() |
|
java.lang.Object |
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)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, providedUpServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled
protected int num_prev_mbrs
public static final java.lang.String name
public 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 boolean isPrintLocalAddr()
public void setPrintLocalAddr(boolean print_local_addr)
public java.lang.String printPreviousMembers()
public long getViewAckCollectionTimeout()
public void setViewAckCollectionTimeout(long view_ack_collection_timeout)
public boolean isViewBundling()
public void setViewBundling(boolean view_bundling)
public long getMaxBundlingTime()
public void setMaxBundlingTime(long max_bundling_time)
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 Protocol
public java.util.Vector<java.lang.Integer> requiredDownServices()
Protocol
requiredDownServices
in class Protocol
public void setImpl(GmsImpl new_impl)
public GmsImpl getImpl()
public void init() throws java.lang.Exception
Protocol
public void start() throws java.lang.Exception
Protocol
Channel.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 Protocol
java.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()
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 becomeCoordinator()
public void becomeParticipant()
public void becomeClient()
public View getNextView(java.util.Collection<Address> new_mbrs, java.util.Collection<Address> old_mbrs, java.util.Collection<Address> suspected_mbrs)
old_mbrs
and
suspected_mbrs
removed and new_mbrs
added.public void castViewChangeWithDest(View new_view, Digest digest, JoinRsp jr, java.util.Collection<Address> newMembers)
new_view
- digest
- newMembers
- public void installView(View new_view)
public void installView(View new_view, Digest digest)
protected Address determineCoordinator()
protected boolean wouldBeNewCoordinator(Address potential_new_coord)
protected boolean checkSelfInclusion(java.util.Vector<Address> mbrs)
public void setDigest(Digest d)
public void mergeDigest(Digest d)
public Digest getDigest()
public java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.public java.lang.Object down(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.
public boolean setProperties(java.util.Properties props)
setProperties
in class Protocol
Copyright ? 1998-2008 Bela Ban. All Rights Reserved.