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 String |
CLIENT |
protected static String |
COORD |
static short |
DELTA_VIEW |
static short |
DIGEST_PRESENT |
protected boolean |
first_view_sent |
protected Class<Callable<Boolean>> |
flushInvokerClass |
protected boolean |
flushProtocolInStack |
protected GmsImpl |
impl |
protected Object |
impl_mutex |
protected Map<String,GmsImpl> |
impls |
protected boolean |
install_view_locally_first
Deprecated.
true by default
|
protected long |
join_timeout |
protected List<Address> |
joining
Members joined but for which no view has been received yet
|
protected long |
leave_timeout |
protected 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
Deprecated.
|
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 String |
PART |
protected BoundedList<Address> |
prev_members
Keeps track of old members (up to num_prev_mbrs)
|
protected BoundedList<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
Deprecated.
|
protected ViewHandler<GmsImpl.Request> |
view_handler
Class to process JOIN, LEAVE and MERGE requests
|
static short |
VIEW_PRESENT |
after_creation_hook, down_prot, ergonomics, id, log, 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 |
castViewChangeAndSendJoinRsps(View new_view,
Digest digest,
Collection<Address> expected_acks,
Collection<Address> joiners,
JoinRsp jr)
Broadcasts the new view and digest as VIEW messages, possibly sends JOIN-RSP messages to joiners and then
waits for acks from expected_acks
|
protected List<Address> |
computeNewMembership(Collection<Collection<Address>> subviews)
Computes a merge membership
|
protected List<Address> |
computeNewMembership(List<Address> current_members,
Collection<Address> joiners,
Collection<Address> leavers,
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) |
Object |
down(Event evt)
An event is to be sent down the stack.
|
String |
dumpViewHandlerHistory() |
String |
dumpViewHandlerQueue() |
void |
fixDigests() |
Digest |
getDigest()
Grabs the current digest from NAKACK{2}
|
GmsImpl |
getImpl() |
String |
getImplementation() |
long |
getJoinTimeout() |
String |
getLocalAddress() |
boolean |
getLogCollectMessages() |
long |
getMaxBundlingTime()
Deprecated.
|
long |
getMaxJoinAttempts() |
String |
getMembers() |
MembershipChangePolicy |
getMembershipChangePolicy() |
String |
getMergeId() |
Merger |
getMerger()
Only used for internal testing, don't use this method !
|
long |
getMergeTimeout() |
View |
getNextView(Collection<Address> joiners,
Collection<Address> leavers,
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.
|
protected ViewHandler |
getViewHandler() |
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 |
isCoord() |
boolean |
isCoordinator() |
boolean |
isMergeInProgress() |
boolean |
isMergeKillerRunning() |
boolean |
isMergeTaskRunning() |
boolean |
isViewBundling()
Deprecated.
|
boolean |
isViewHandlerSuspended() |
GMS |
joinTimeout(long timeout) |
protected static Buffer |
marshal(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
|
String |
printMergeIdHistory() |
String |
printPreviousMembers() |
String |
printPreviousViews() |
protected void |
process(Collection<GmsImpl.Request> requests) |
List<Integer> |
providedDownServices()
List of events that are provided to layers below (they will be handled when sent from down below)
|
protected JoinRsp |
readJoinRsp(byte[] buffer,
int offset,
int length) |
protected 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) |
List<Integer> |
requiredDownServices()
List of events that are required to be answered by some layer below
|
void |
resetStats() |
void |
resumeViewHandler() |
protected void |
sendJoinResponse(Buffer marshalled_rsp,
Address dest) |
void |
sendJoinResponse(JoinRsp rsp,
Address dest) |
protected void |
sendJoinResponses(JoinRsp jr,
Collection<Address> joiners) |
protected void |
sendViewAck(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)
Deprecated.
|
GMS |
setMaxJoinAttempts(long t) |
void |
setMembershipChangePolicy(MembershipChangePolicy membership_change_policy) |
void |
setMembershipChangePolicy(String classname) |
void |
setMergeTimeout(long timeout) |
void |
setPrintLocalAddr(boolean flag) |
void |
setPrintLocalAddress(boolean flag) |
void |
setViewAckCollectionTimeout(long view_ack_collection_timeout) |
void |
setViewBundling(boolean ignored)
Deprecated.
|
void |
start()
This method is called on a
JChannel.connect(String) . |
void |
stop()
This method is called on a
JChannel.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 protocol below.
|
Object |
up(Message msg)
A single message was received.
|
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, down, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, providedUpServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, up
protected static final String CLIENT
protected static final String COORD
protected static final 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 view_bundling
protected boolean use_delta_views
@Deprecated 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
@Deprecated protected boolean install_view_locally_first
protected int num_views
protected BoundedList<String> prev_views
protected GmsImpl impl
protected final Object impl_mutex
protected Merger merger
protected Address local_addr
protected final Membership members
protected final Membership tmp_members
protected MembershipChangePolicy membership_change_policy
protected final List<Address> joining
protected final List<Address> leaving
protected BoundedList<Address> prev_members
protected volatile View view
protected long ltime
protected TimeScheduler timer
protected final ViewHandler<GmsImpl.Request> 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 String getView()
public int getNumberOfViews()
public String getLocalAddress()
public 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 GMS setMaxJoinAttempts(long t)
public String getImplementation()
public boolean isCoord()
public MembershipChangePolicy getMembershipChangePolicy()
public void setMembershipChangePolicy(MembershipChangePolicy membership_change_policy)
public String getMergeId()
public boolean isMergeInProgress()
public Merger getMerger()
public void setMembershipChangePolicy(String classname)
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)
@Deprecated public boolean isViewBundling()
@Deprecated public void setViewBundling(boolean ignored)
@Deprecated public long getMaxBundlingTime()
@Deprecated 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()
protected ViewHandler getViewHandler()
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
JChannel.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 JChannel.connect(String)
will throw an exceptionpublic void stop()
Protocol
JChannel.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> joiners, Collection<Address> leavers, Collection<Address> suspected_mbrs)
leavers
and
suspected_mbrs
removed and joiners
added.protected List<Address> computeNewMembership(List<Address> current_members, Collection<Address> joiners, Collection<Address> leavers, Collection<Address> suspects)
protected List<Address> computeNewMembership(Collection<Collection<Address>> subviews)
public void castViewChangeAndSendJoinRsps(View new_view, Digest digest, Collection<Address> expected_acks, Collection<Address> joiners, JoinRsp jr)
new_view
- the new view (View
or MergeView
)digest
- the digest, can be null if new_view is not a MergeViewexpected_acks
- the members from which to wait for VIEW_ACKs (self will be excluded)joiners
- the list of members to which to send the join response (jr). If null, no JOIN_RSPs will be sentjr
- the JoinRsp
. If null (or joiners is null), no JOIN_RSPs will be sentprotected void sendJoinResponses(JoinRsp jr, Collection<Address> joiners)
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 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 up(Message msg)
Protocol
public Object down(Event evt)
Protocol
down_prot.down()
.public Map<String,String> handleProbe(String... keys)
DiagnosticsHandler.ProbeHandler
handleProbe
in interface DiagnosticsHandler.ProbeHandler
public String[] supportedKeys()
DiagnosticsHandler.ProbeHandler
supportedKeys
in interface DiagnosticsHandler.ProbeHandler
protected void sendViewAck(Address dest)
protected View createViewFromDeltaView(View current_view, DeltaView delta_view)
protected static Buffer marshal(Collection<? extends Address> mbrs)
protected JoinRsp readJoinRsp(byte[] buffer, int offset, int length)
protected 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 Exception
Exception
protected ViewId readViewId(byte[] buffer, int offset, int length)
protected void process(Collection<GmsImpl.Request> requests)
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.