|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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
|
Field Summary | |
---|---|
protected AckCollector |
ack_collector
To collect VIEW_ACKs from all members |
protected java.lang.Class<java.util.concurrent.Callable<java.lang.Boolean>> |
flushInvokerClass
|
protected Address |
local_addr
|
protected long |
ltime
|
protected Membership |
members
|
protected AckCollector |
merge_ack_collector
|
protected int |
num_prev_mbrs
|
protected TimeScheduler |
timer
|
protected View |
view
|
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
GMS()
|
Method Summary | |
---|---|
MergeId |
_getMergeId()
|
protected boolean |
_startFlush(View new_view,
int maxAttempts,
boolean resumeIfFailed,
long randomFloor,
long randomCeiling)
|
void |
becomeClient()
|
void |
becomeCoordinator()
|
void |
becomeParticipant()
|
void |
cancelMerge()
|
void |
castViewChange(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 Address |
determineCoordinator()
|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack. |
java.lang.String |
dumpViewHandlerHistory()
|
java.lang.String |
dumpViewHandlerQueue()
|
void |
fixDigests()
|
Digest |
getDigest()
Sends down a GET_DIGEST event and waits for the GET_DIGEST_OK response, or timeout, whichever occurs first |
GmsImpl |
getImpl()
|
long |
getJoinTimeout()
|
java.lang.String |
getLocalAddress()
|
boolean |
getLogCollectMessages()
|
long |
getMaxBundlingTime()
|
long |
getMaxJoinAttempts()
|
java.lang.String |
getMembers()
|
java.lang.String |
getMergeId()
|
Merger |
getMerger()
Only used for internal testing, don't use this method ! |
long |
getMergeTimeout()
|
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()
|
Tuple<View,Digest> |
getViewAndDigest()
Returns the current view and digest |
int |
getViewHandlerSize()
|
ViewId |
getViewId()
|
java.util.Map<java.lang.String,java.lang.String> |
handleProbe(java.lang.String... keys)
Handles a probe. |
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 |
isMergeInProgress()
|
boolean |
isMergeKillerRunning()
|
boolean |
isMergeTaskRunning()
|
boolean |
isViewBundling()
|
boolean |
isViewHandlerSuspended()
|
void |
mergeDigest(Digest d)
Send down a MERGE_DIGEST event |
java.lang.String |
printMergeIdHistory()
|
java.lang.String |
printPreviousMembers()
|
java.lang.String |
printPreviousViews()
|
java.util.List<java.lang.Integer> |
providedDownServices()
List of events that are provided to layers below (they will be handled when sent down below) |
java.util.List<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 |
setJoinTimeout(long t)
|
void |
setLogCollectMessages(boolean flag)
|
void |
setMaxBundlingTime(long max_bundling_time)
|
void |
setMaxJoinAttempts(long t)
|
void |
setMergeTimeout(long timeout)
|
void |
setPrintLocalAddr(boolean flag)
|
void |
setPrintLocalAddress(boolean flag)
|
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() . |
java.lang.String[] |
supportedKeys()
Returns a list of supported keys |
void |
suspect(java.lang.String suspected_member)
|
void |
suspendViewHandler()
|
java.lang.Object |
up(Event evt)
An event was received from the layer below. |
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, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedUpServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled |
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
protected java.lang.Class<java.util.concurrent.Callable<java.lang.Boolean>> flushInvokerClass
protected Address local_addr
protected final Membership members
protected View view
protected long ltime
protected TimeScheduler timer
protected final AckCollector ack_collector
protected final AckCollector merge_ack_collector
Constructor Detail |
---|
public GMS()
Method Detail |
---|
public ViewId getViewId()
public Tuple<View,Digest> getViewAndDigest()
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 getMergeTimeout()
public void setMergeTimeout(long timeout)
public long getMaxJoinAttempts()
public void setMaxJoinAttempts(long t)
public java.lang.String getMergeId()
public boolean isMergeInProgress()
public Merger getMerger()
public java.lang.String printMergeIdHistory()
public java.lang.String printPreviousMembers()
public void setPrintLocalAddress(boolean flag)
public void setPrintLocalAddr(boolean flag)
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 getViewHandlerSize()
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 void suspect(java.lang.String suspected_member)
public boolean isCoordinator()
public MergeId _getMergeId()
public void setLogCollectMessages(boolean flag)
public boolean getLogCollectMessages()
public void resetStats()
resetStats
in class Protocol
public java.util.List<java.lang.Integer> requiredDownServices()
Protocol
requiredDownServices
in class Protocol
public java.util.List<java.lang.Integer> providedDownServices()
Protocol
providedDownServices
in class Protocol
public void setImpl(GmsImpl new_impl)
public GmsImpl getImpl()
public void init() throws java.lang.Exception
Protocol
init
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic 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 flushed
stop
in class Protocol
public void becomeCoordinator()
public void becomeParticipant()
public void becomeClient()
public void fixDigests()
public void cancelMerge()
public boolean isMergeTaskRunning()
public boolean isMergeKillerRunning()
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 castViewChange(View new_view, Digest digest, JoinRsp jr, java.util.Collection<Address> newMembers)
public void sendJoinResponse(JoinRsp rsp, Address dest)
public void installView(View new_view)
public void installView(View new_view, Digest digest)
protected Address determineCoordinator()
protected boolean wouldBeNewCoordinator(Address potential_new_coord)
public void setDigest(Digest d)
public void mergeDigest(Digest d)
public Digest getDigest()
protected boolean _startFlush(View new_view, int maxAttempts, boolean resumeIfFailed, long randomFloor, long randomCeiling)
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()
.
up
in class Protocol
public java.lang.Object down(Event evt)
Protocol
down_prot.down()
. 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 up_prot.up()
.
down
in class Protocol
public java.util.Map<java.lang.String,java.lang.String> handleProbe(java.lang.String... keys)
DiagnosticsHandler.ProbeHandler
handleProbe
in interface DiagnosticsHandler.ProbeHandler
public java.lang.String[] supportedKeys()
DiagnosticsHandler.ProbeHandler
supportedKeys
in interface DiagnosticsHandler.ProbeHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |