public class GMS extends Protocol implements DiagnosticsHandler.ProbeHandler
Modifier and Type | Class and Description |
---|---|
static class |
GMS.GmsHeader |
Modifier and Type | Field and Description |
---|---|
protected AckCollector |
ack_collector
To collect VIEW_ACKs from all members
|
protected Class<Callable<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 |
Constructor and Description |
---|
GMS() |
Modifier and Type | Method and Description |
---|---|
MergeId |
_getMergeId() |
protected boolean |
_startFlush(View new_view,
int maxAttempts,
long randomFloor,
long randomCeiling) |
void |
becomeClient() |
void |
becomeCoordinator() |
void |
becomeParticipant() |
void |
cancelMerge() |
void |
castViewChangeWithDest(View new_view,
Digest digest,
JoinRsp jr,
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() |
Object |
down(Event evt)
An event is to be sent down the stack.
|
String |
dumpViewHandlerHistory() |
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() |
String |
getLocalAddress() |
boolean |
getLogCollectMessages() |
long |
getMaxBundlingTime() |
String |
getMembers() |
String |
getMergeId() |
Merger |
getMerger()
Only used for internal testing, don't use this method !
|
long |
getMergeTimeout() |
View |
getNextView(Collection<Address> new_mbrs,
Collection<Address> old_mbrs,
Collection<Address> suspected_mbrs)
Computes the next view.
|
int |
getNumberOfViews() |
int |
getNumMembers() |
String |
getView() |
long |
getViewAckCollectionTimeout() |
Tuple<View,Digest> |
getViewAndDigest()
Returns the current view and digest
|
int |
getViewHandlerSize() |
ViewId |
getViewId() |
Map<String,String> |
handleProbe(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
|
String |
printMergeIdHistory() |
String |
printPreviousMembers() |
String |
printPreviousViews() |
List<Integer> |
providedDownServices()
List of events that are provided to layers below (they will be handled when sent down from
below).
|
List<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 |
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() . |
String[] |
supportedKeys()
Returns a list of supported keys
|
void |
suspect(String suspected_member) |
void |
suspendViewHandler() |
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)
|
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedUpServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled
protected int num_prev_mbrs
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
public ViewId getViewId()
public String getView()
public int getNumberOfViews()
public String getLocalAddress()
public String getMembers()
public int getNumMembers()
public long getJoinTimeout()
public void setJoinTimeout(long t)
public long getMergeTimeout()
public void setMergeTimeout(long timeout)
public String getMergeId()
public boolean isMergeInProgress()
public Merger getMerger()
public String printMergeIdHistory()
public 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 String dumpViewHandlerQueue()
public String dumpViewHandlerHistory()
public void suspendViewHandler()
public void resumeViewHandler()
public String printPreviousViews()
public void suspect(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 List<Integer> requiredDownServices()
Protocol
requiredDownServices
in class Protocol
public List<Integer> providedDownServices()
Protocol
providedDownServices
in class Protocol
public void setImpl(GmsImpl new_impl)
public GmsImpl getImpl()
public void init() throws Exception
Protocol
public void start() throws 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
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 void fixDigests()
public void cancelMerge()
public boolean isMergeTaskRunning()
public boolean isMergeKillerRunning()
public View getNextView(Collection<Address> new_mbrs, Collection<Address> old_mbrs, Collection<Address> suspected_mbrs)
old_mbrs
and
suspected_mbrs
removed and new_mbrs
added.public void castViewChangeWithDest(View new_view, Digest digest, JoinRsp jr, 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)
public void setDigest(Digest d)
public void mergeDigest(Digest d)
public Digest getDigest()
protected boolean _startFlush(View new_view, int maxAttempts, long randomFloor, long randomCeiling)
public 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 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()
.public Map<String,String> handleProbe(String... keys)
DiagnosticsHandler.ProbeHandler
handleProbe
in interface DiagnosticsHandler.ProbeHandler
public String[] supportedKeys()
DiagnosticsHandler.ProbeHandler
supportedKeys
in interface DiagnosticsHandler.ProbeHandler
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.