Package org.jgroups.protocols
Class FailureDetection
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.FailureDetection
- All Implemented Interfaces:
Lifecycle
- Since:
- 5.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class(package private) classClass which periodically multicasts a HEARTBEAT message to the cluster(package private) class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Future<?> protected longprotected final Lockprotected final AtomicBooleanprotected intprotected intprotected intprotected final BoundedList<Tuple<Address, Long>> protected longprotected Future<?> protected TimeSchedulerFields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RunnableAn event is to be sent down the stack.A message is sent down the stack.intintlongintlongprotected abstract Stringprotected abstract longprotected voidvoidinit()Called after a protocol has been created and before the protocol is started.booleanbooleanbooleanprotected abstract <T> booleanneedsToBeSuspected(Address mbr, T value) voidprotected voidretainKeys(List<Address> mbrs) <T extends FailureDetection>
TsetInterval(long i) <T extends FailureDetection>
TsetTimeout(long t) voidprotected voidprotected voidvoidstop()Called on aJChannel.disconnect(); stops work (e.g.voidprotected voidprotected voidprotected voidprotected booleanRemoves mbr from suspected_mbrs and sends a UNSUSPECT event up and down the stackA single message was received.voidup(MessageBatch batch) Sends up a multiple messages in aMessageBatch.protected abstract voidMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, start, statsEnabled, toString, up
-
Field Details
-
timeout
protected long timeout -
interval
protected long interval -
num_heartbeats_sent
protected int num_heartbeats_sent -
num_heartbeats_received
protected int num_heartbeats_received -
num_suspect_events
protected int num_suspect_events -
has_suspected_mbrs
protected volatile boolean has_suspected_mbrs -
members
-
suspected_mbrs
-
suspect_history
-
lock
-
timer
-
HAS_HEADER
-
heartbeat_sender
-
timeout_checker
-
mcast_sent
-
-
Constructor Details
-
FailureDetection
public FailureDetection()
-
-
Method Details
-
getTimestamps
-
getTimeoutCheckInterval
protected abstract long getTimeoutCheckInterval() -
getTimeoutCheckerInfo
-
update
-
needsToBeSuspected
-
getTimeout
public long getTimeout() -
setTimeout
-
getInterval
public long getInterval() -
setInterval
-
getHeartbeatsSent
public int getHeartbeatsSent() -
getHeartbeatsReceived
public int getHeartbeatsReceived() -
getSuspectEventsSent
public int getSuspectEventsSent() -
retainKeys
-
createTimeoutChecker
-
getMembers
-
getSuspectedMembers
-
isRunning
public boolean isRunning() -
isTimeoutCheckerRunning
public boolean isTimeoutCheckerRunning() -
isHeartbeatSenderRunning
public boolean isHeartbeatSenderRunning() -
startFailureDetection
public void startFailureDetection() -
stopFailureDetection
public void stopFailureDetection() -
printSuspectHistory
-
resetStats
public void resetStats()- Overrides:
resetStatsin classProtocol
-
init
Description copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent. -
stop
public void stop()Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom. -
down
Description copied from class:ProtocolAn event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_prot.down(). -
down
Description copied from class:ProtocolA message is sent down the stack. Protocols may examine the message and do something (e.g. add a header) with it, before passing it down. -
up
Description copied from class:ProtocolA single message was received. Protocols may examine the message and do something (e.g. add a header) with it before passing it up. -
up
Description copied from class:ProtocolSends up a multiple messages in aMessageBatch. The sender of the batch is always the same, and so is the destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed messages, although the transport itself will create initial MessageBatches that contain only either OOB or regular messages.The default processing below sends messages up the stack individually, based on a matching criteria (calling
Protocol.accept(Message)), and - if true - callsProtocol.up(org.jgroups.Event)for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped.Subclasses should check if there are any messages destined for them (e.g. using
MessageBatch.iterator(Predicate)), then possibly remove and process them and finally pass the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all encrypted messages in the batch, not remove them, and pass the batch up when done. -
handleViewChange
-
suspect
-
unsuspect
Removes mbr from suspected_mbrs and sends a UNSUSPECT event up and down the stack- Parameters:
mbr- The member to be unsuspected- Returns:
- True if the member was removed from suspected_mbrs, otherwise false
-
startHeartbeatSender
protected void startHeartbeatSender() -
stopHeartbeatSender
protected void stopHeartbeatSender() -
startTimeoutChecker
protected void startTimeoutChecker() -
stopTimeoutChecker
protected void stopTimeoutChecker()
-