public class GMS extends Protocol implements DiagnosticsHandler.ProbeHandler
Modifier and Type | Class and Description |
---|---|
static class |
GMS.DefaultMembershipPolicy |
static class |
GMS.GmsHeader |
Modifier and Type | Field and Description |
---|---|
protected AckCollector |
ack_collector
To collect VIEW_ACKs from all members
|
protected static java.lang.String |
CLIENT |
protected static java.lang.String |
COORD |
static short |
DELTA_VIEW |
static short |
DIGEST_PRESENT |
protected boolean |
first_view_sent |
protected java.lang.Class<java.util.concurrent.Callable<java.lang.Boolean>> |
flushInvokerClass |
protected boolean |
flushProtocolInStack |
protected boolean |
handle_concurrent_startup
Deprecated.
|
protected GmsImpl |
impl |
protected java.lang.Object |
impl_mutex |
protected java.util.Map<java.lang.String,GmsImpl> |
impls |
protected boolean |
install_view_locally_first |
protected long |
join_timeout |
protected java.util.List<Address> |
joining
Members joined but for which no view has been received yet
|
protected long |
leave_timeout |
protected java.util.List<Address> |
leaving
Members excluded from group, but for which no view has been received yet
|
protected Address |
local_addr |
protected boolean |
log_collect_msgs |
protected boolean |
log_view_warnings |
protected long |
ltime |
protected long |
max_bundling_time |
protected long |
max_join_attempts |
protected Membership |
members |
protected MembershipChangePolicy |
membership_change_policy |
protected AckCollector |
merge_ack_collector |
protected long |
merge_timeout |
static short |
MERGE_VIEW |
protected Merger |
merger |
protected int |
num_prev_mbrs |
protected int |
num_prev_views |
protected int |
num_views |
protected static java.lang.String |
PART |
protected BoundedList<Address> |
prev_members
Keeps track of old members (up to num_prev_mbrs)
|
protected BoundedList<java.lang.String> |
prev_views
Stores the last 20 views
|
protected boolean |
print_local_addr |
protected boolean |
print_physical_addrs |
static short |
READ_ADDRS |
protected long |
resume_task_timeout |
protected TimeScheduler |
timer |
protected Membership |
tmp_members |
protected boolean |
use_delta_views |
protected boolean |
use_flush_if_present |
protected View |
view |
protected long |
view_ack_collection_timeout |
protected boolean |
view_bundling
Whether view bundling (http://jira.jboss.com/jira/browse/JGRP-144) should be enabled or not.
|
protected org.jgroups.protocols.pbcast.GMS.ViewHandler |
view_handler
Class to process JOIN, LEAVE and MERGE requests
|
static short |
VIEW_PRESENT |
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Constructor and Description |
---|
GMS() |
Modifier and Type | Method and Description |
---|---|
MergeId |
_getMergeId() |
static Tuple<View,Digest> |
_readViewAndDigest(byte[] buffer,
int offset,
int length) |
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,
java.util.Collection<Address> newMembers)
Broadcasts the new view and digest as a VIEW message and waits for acks from existing members
|
protected java.util.List<Address> |
computeNewMembership(java.util.Collection<java.util.Collection<Address>> subviews)
Computes a merge membership
|
protected java.util.List<Address> |
computeNewMembership(java.util.List<Address> current_members,
java.util.Collection<Address> joiners,
java.util.Collection<Address> leavers,
java.util.Collection<Address> suspects)
Computes the regular membership
|
protected static View |
createDeltaView(View current_view,
View next_view) |
protected View |
createViewFromDeltaView(View current_view,
DeltaView delta_view) |
protected Address |
determineCoordinator() |
protected static short |
determineFlags(View view,
Digest digest) |
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()
Grabs the current digest from NAKACK{2}
|
GmsImpl |
getImpl() |
java.lang.String |
getImplementation() |
long |
getJoinTimeout() |
java.lang.String |
getLocalAddress() |
boolean |
getLogCollectMessages() |
long |
getMaxBundlingTime() |
long |
getMaxJoinAttempts() |
java.lang.String |
getMembers() |
MembershipChangePolicy |
getMembershipChangePolicy() |
java.lang.String |
getMergeId() |
Merger |
getMerger()
Only used for internal testing, don't use this method !
|
long |
getMergeTimeout() |
View |
getNextView(java.util.Collection<Address> joiners,
java.util.Collection<Address> leavers,
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 |
isCoord() |
boolean |
isCoordinator() |
boolean |
isMergeInProgress() |
boolean |
isMergeKillerRunning() |
boolean |
isMergeTaskRunning() |
boolean |
isViewBundling() |
boolean |
isViewHandlerSuspended() |
GMS |
joinTimeout(long timeout) |
protected static Buffer |
marshal(java.util.Collection<? extends Address> mbrs) |
static Buffer |
marshal(JoinRsp join_rsp) |
protected static Buffer |
marshal(View view,
Digest digest) |
protected static Buffer |
marshal(ViewId view_id) |
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)
|
protected JoinRsp |
readJoinRsp(byte[] buffer,
int offset,
int length) |
protected java.util.Collection<? extends Address> |
readMembers(byte[] buffer,
int offset,
int length) |
protected Tuple<View,Digest> |
readViewAndDigest(byte[] buffer,
int offset,
int length) |
protected ViewId |
readViewId(byte[] buffer,
int offset,
int length) |
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 |
sendJoinResponses(JoinRsp jr,
java.util.Collection<Address> newMembers) |
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 |
setMembershipChangePolicy(MembershipChangePolicy membership_change_policy) |
void |
setMembershipChangePolicy(java.lang.String classname) |
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.
|
View |
view() |
protected boolean |
wouldBeNewCoordinator(Address potential_new_coord)
Checks whether the potential_new_coord would be the new coordinator (2nd in line)
|
protected static boolean |
writeAddresses(View view,
Digest digest) |
accept, afterCreationHook, destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedUpServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, up
protected static final java.lang.String CLIENT
protected static final java.lang.String COORD
protected static final java.lang.String PART
public static final short VIEW_PRESENT
public static final short DIGEST_PRESENT
public static final short MERGE_VIEW
public static final short DELTA_VIEW
public static final short READ_ADDRS
protected long join_timeout
protected long leave_timeout
protected long merge_timeout
protected long max_join_attempts
protected boolean print_local_addr
protected boolean print_physical_addrs
@Deprecated protected boolean handle_concurrent_startup
protected boolean view_bundling
protected boolean use_delta_views
protected long max_bundling_time
protected int num_prev_mbrs
protected int num_prev_views
protected long view_ack_collection_timeout
protected long resume_task_timeout
protected boolean use_flush_if_present
protected boolean log_collect_msgs
protected boolean log_view_warnings
protected boolean install_view_locally_first
protected int num_views
protected BoundedList<java.lang.String> prev_views
protected java.lang.Class<java.util.concurrent.Callable<java.lang.Boolean>> flushInvokerClass
protected GmsImpl impl
protected final java.lang.Object impl_mutex
protected final java.util.Map<java.lang.String,GmsImpl> impls
protected Merger merger
protected Address local_addr
protected final Membership members
protected final Membership tmp_members
protected MembershipChangePolicy membership_change_policy
protected final java.util.List<Address> joining
protected final java.util.List<Address> leaving
protected BoundedList<Address> prev_members
protected volatile View view
protected long ltime
protected TimeScheduler timer
protected final org.jgroups.protocols.pbcast.GMS.ViewHandler view_handler
protected final AckCollector ack_collector
protected final AckCollector merge_ack_collector
protected boolean flushProtocolInStack
protected boolean first_view_sent
public ViewId getViewId()
public View view()
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 GMS joinTimeout(long timeout)
public long getMergeTimeout()
public void setMergeTimeout(long timeout)
public long getMaxJoinAttempts()
public void setMaxJoinAttempts(long t)
public java.lang.String getImplementation()
public boolean isCoord()
public MembershipChangePolicy getMembershipChangePolicy()
public void setMembershipChangePolicy(MembershipChangePolicy membership_change_policy)
public java.lang.String getMergeId()
public boolean isMergeInProgress()
public Merger getMerger()
public void setMembershipChangePolicy(java.lang.String classname)
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
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 void fixDigests()
public void cancelMerge()
public boolean isMergeTaskRunning()
public boolean isMergeKillerRunning()
public View getNextView(java.util.Collection<Address> joiners, java.util.Collection<Address> leavers, java.util.Collection<Address> suspected_mbrs)
leavers
and
suspected_mbrs
removed and joiners
added.protected java.util.List<Address> computeNewMembership(java.util.List<Address> current_members, java.util.Collection<Address> joiners, java.util.Collection<Address> leavers, java.util.Collection<Address> suspects)
protected java.util.List<Address> computeNewMembership(java.util.Collection<java.util.Collection<Address>> subviews)
public void castViewChange(View new_view, Digest digest, java.util.Collection<Address> newMembers)
public void sendJoinResponses(JoinRsp jr, java.util.Collection<Address> 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, 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()
.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()
.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
protected View createViewFromDeltaView(View current_view, DeltaView delta_view)
protected JoinRsp readJoinRsp(byte[] buffer, int offset, int length)
protected java.util.Collection<? extends Address> readMembers(byte[] buffer, int offset, int length)
protected Tuple<View,Digest> readViewAndDigest(byte[] buffer, int offset, int length)
public static Tuple<View,Digest> _readViewAndDigest(byte[] buffer, int offset, int length) throws java.lang.Exception
java.lang.Exception
protected ViewId readViewId(byte[] buffer, int offset, int length)
Copyright © 1998-2020 Red Hat. All Rights Reserved.