Package org.jgroups.protocols
Class FD_ALL3
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.FailureDetection
-
- org.jgroups.protocols.FD_ALL3
-
- All Implemented Interfaces:
Lifecycle
public class FD_ALL3 extends FailureDetection
Failure detection based on simple heartbeat protocol. Every member periodically (interval ms) multicasts a heartbeat. Every member maintains a table of all members (minus itself) and a bitmap with timeout/interval bits, initially all set to 1. On each interval, the TimeoutChecker task advances the index and sets the bit at the index to 0.
When all bits are 0, a member will be suspected.
On reception of a message or heartbeat from P, P's bitmap at index is set to 1.
JIRA: https://issues.redhat.com/browse/JGRP-2451- Version:
- 5.0.0
- Author:
- Dan Berindei, Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFD_ALL3.Bitmap-
Nested classes/interfaces inherited from class org.jgroups.protocols.FailureDetection
FailureDetection.HeartbeatHeader
-
-
Field Summary
Fields Modifier and Type Field Description protected intnum_bitsprotected java.util.Map<Address,FD_ALL3.Bitmap>timestamps-
Fields inherited from class org.jgroups.protocols.FailureDetection
HAS_HEADER, has_suspected_mbrs, heartbeat_sender, interval, lock, mcast_sent, members, num_heartbeats_received, num_heartbeats_sent, num_suspect_events, suspect_history, suspected_mbrs, timeout, timeout_checker, timer
-
Fields 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 Constructor Description FD_ALL3()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String_printTimestamps()protected intcomputeBits()protected java.lang.StringgetTimeoutCheckerInfo()protected longgetTimeoutCheckInterval()protected java.util.Map<Address,?>getTimestamps()voidinit()Called after a protocol has been created and before the protocol is started.protected <T> booleanneedsToBeSuspected(Address mbr, T value)java.lang.StringprintTimestamps()FD_ALL3setInterval(long i)FD_ALL3setTimeout(long t)voidstart()This method is called on aJChannel.connect(String); starts work.protected voidupdate(Address sender, boolean log_msg, boolean skip_if_exists)-
Methods inherited from class org.jgroups.protocols.FailureDetection
createTimeoutChecker, down, down, getHeartbeatsReceived, getHeartbeatsSent, getInterval, getMembers, getSuspectedMembers, getSuspectEventsSent, getTimeout, handleViewChange, isHeartbeatSenderRunning, isRunning, isTimeoutCheckerRunning, printSuspectHistory, resetStats, retainKeys, startFailureDetection, startHeartbeatSender, startTimeoutChecker, stop, stopFailureDetection, stopHeartbeatSender, stopTimeoutChecker, suspect, unsuspect, up, up
-
Methods 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, statsEnabled, toString, up
-
-
-
-
Field Detail
-
timestamps
protected final java.util.Map<Address,FD_ALL3.Bitmap> timestamps
-
num_bits
protected int num_bits
-
-
Method Detail
-
getTimestamps
protected java.util.Map<Address,?> getTimestamps()
- Specified by:
getTimestampsin classFailureDetection
-
getTimeoutCheckInterval
protected long getTimeoutCheckInterval()
- Specified by:
getTimeoutCheckIntervalin classFailureDetection
-
printTimestamps
public java.lang.String printTimestamps()
-
init
public void init() throws java.lang.ExceptionDescription 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.- Specified by:
initin interfaceLifecycle- Overrides:
initin classFailureDetection- Throws:
java.lang.Exception- Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the the channel constructor will throw an exception
-
start
public void start() throws java.lang.ExceptionDescription copied from class:ProtocolThis method is called on aJChannel.connect(String); starts work. Protocols are connected ready to receive events. Will be called from bottom to top.- Specified by:
startin interfaceLifecycle- Overrides:
startin classProtocol- Throws:
java.lang.Exception- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soJChannel.connect(String)will throw an exception
-
setTimeout
public FD_ALL3 setTimeout(long t)
- Overrides:
setTimeoutin classFailureDetection
-
setInterval
public FD_ALL3 setInterval(long i)
- Overrides:
setIntervalin classFailureDetection
-
update
protected void update(Address sender, boolean log_msg, boolean skip_if_exists)
- Specified by:
updatein classFailureDetection
-
computeBits
protected int computeBits()
-
needsToBeSuspected
protected <T> boolean needsToBeSuspected(Address mbr, T value)
- Specified by:
needsToBeSuspectedin classFailureDetection
-
getTimeoutCheckerInfo
protected java.lang.String getTimeoutCheckerInfo()
- Specified by:
getTimeoutCheckerInfoin classFailureDetection
-
_printTimestamps
protected java.lang.String _printTimestamps()
-
-