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 class
FD_ALL3.Bitmap
-
Nested classes/interfaces inherited from class org.jgroups.protocols.FailureDetection
FailureDetection.HeartbeatHeader
-
-
Field Summary
Fields Modifier and Type Field Description protected int
num_bits
protected 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 int
computeBits()
protected java.lang.String
getTimeoutCheckerInfo()
protected long
getTimeoutCheckInterval()
protected java.util.Map<Address,?>
getTimestamps()
void
init()
Called after a protocol has been created and before the protocol is started.protected <T> boolean
needsToBeSuspected(Address mbr, T value)
java.lang.String
printTimestamps()
FD_ALL3
setInterval(long i)
FD_ALL3
setTimeout(long t)
void
start()
This method is called on aJChannel.connect(String)
; starts work.protected void
update(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:
getTimestamps
in classFailureDetection
-
getTimeoutCheckInterval
protected long getTimeoutCheckInterval()
- Specified by:
getTimeoutCheckInterval
in classFailureDetection
-
printTimestamps
public java.lang.String printTimestamps()
-
init
public void init() throws java.lang.Exception
Description copied from class:Protocol
Called 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:
init
in interfaceLifecycle
- Overrides:
init
in 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.Exception
Description copied from class:Protocol
This 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:
start
in interfaceLifecycle
- Overrides:
start
in 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:
setTimeout
in classFailureDetection
-
setInterval
public FD_ALL3 setInterval(long i)
- Overrides:
setInterval
in classFailureDetection
-
update
protected void update(Address sender, boolean log_msg, boolean skip_if_exists)
- Specified by:
update
in classFailureDetection
-
computeBits
protected int computeBits()
-
needsToBeSuspected
protected <T> boolean needsToBeSuspected(Address mbr, T value)
- Specified by:
needsToBeSuspected
in classFailureDetection
-
getTimeoutCheckerInfo
protected java.lang.String getTimeoutCheckerInfo()
- Specified by:
getTimeoutCheckerInfo
in classFailureDetection
-
_printTimestamps
protected java.lang.String _printTimestamps()
-
-