public class GMS extends Protocol implements TP.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 |
protected ViewId |
view_id |
Constructor and Description |
---|
GMS() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_startFlush(View new_view,
int maxAttempts,
long randomFloor,
long randomCeiling) |
void |
becomeClient() |
void |
becomeCoordinator() |
void |
becomeParticipant() |
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 boolean |
checkSelfInclusion(Vector<Address> mbrs)
Returns true if local_addr is member of mbrs, else false
|
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() |
static long |
getJoinRetryTimeout()
Deprecated.
|
long |
getJoinTimeout() |
String |
getLocalAddress() |
boolean |
getLogCollectMessages() |
long |
getMaxBundlingTime() |
String |
getMembers() |
MergeId |
getMergeId() |
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() |
int |
getViewHandlerSize() |
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() |
static boolean |
isShun()
Deprecated.
|
boolean |
isViewBundling() |
boolean |
isViewHandlerSuspended() |
View |
makeView(Vector<Address> mbrs) |
static View |
makeView(Vector<Address> mbrs,
ViewId vid) |
void |
mergeDigest(Digest d)
Send down a MERGE_DIGEST event
|
String |
printPreviousMembers() |
String |
printPreviousViews() |
Vector<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 |
setLogCollectMessages(boolean flag) |
void |
setMaxBundlingTime(long max_bundling_time) |
void |
setMergeTimeout(long timeout) |
void |
setPrintLocalAddr(boolean flag) |
void |
setPrintLocalAddress(boolean flag) |
void |
setShun(boolean s)
Deprecated.
|
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, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
protected int num_prev_mbrs
protected Address local_addr
protected final Membership members
protected View view
protected ViewId view_id
protected long ltime
protected TimeScheduler timer
protected final AckCollector ack_collector
protected final AckCollector merge_ack_collector
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 static long getJoinRetryTimeout()
public void setJoinRetryTimeout(long t)
@Deprecated public static boolean isShun()
@Deprecated public void setShun(boolean s)
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 Vector<Integer> requiredDownServices()
Protocol
requiredDownServices
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 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)
protected boolean checkSelfInclusion(Vector<Address> mbrs)
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)
TP.ProbeHandler
handleProbe
in interface TP.ProbeHandler
public String[] supportedKeys()
TP.ProbeHandler
supportedKeys
in interface TP.ProbeHandler
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.