Package org.jgroups.protocols
Class FD_HOST
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.FD_HOST
- All Implemented Interfaces:
Lifecycle
Failure detection protocol which detects the crash or hanging of entire hosts and suspects all cluster members
on those hosts. By default InetAddress.isReachable() is used, but any script/command can be used for liveness checks
by defining the 'cmd' property.
FD_HOST does not detect the crash or hanging of single members on the local host, but only checks liveness
of all other hosts in a cluster. Therefore it is meant to be used together with other failure detection protocols,
e.g. FD_ALL3 and FD_SOCK.
This protocol would typically be used when multiple cluster members are running on the same physical box.
JIRA: https://issues.redhat.com/browse/JGRP-1855
- Version:
- 3.5, 3.4.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprotected static classstatic classstatic interfaceCommand used to check whether a given host is alive, periodically calledprotected classSelected members run this task periodically. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected Stringprotected booleanprotected final Map<InetAddress, List<Address>> Map of hosts and their cluster members, updated on view changes.protected longprotected InetAddressprotected intprotected intprotected FD_HOST.PingCommandThe command to detect whether a target is aliveprotected Future<?> protected final BoundedList<Tuple<InetAddress, Long>> protected TimeServiceprotected longprotected TimeSchedulerTimer used to run the ping task onprotected final ConcurrentMap<InetAddress, Long> protected booleanFields 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 StringAn event is to be sent down the stack.protected longgetAgeOf(InetAddress host) Returns the age (in secs) of the given hostprotected InetAddressgetHostFor(Address mbr) protected PhysicalAddressgetPhysicalAddress(Address logical_addr) protected longprotected voidhandleView(View view) voidinit()Called after a protocol has been created and before the protocol is started.booleanprotected booleanbooleanvoidsetCommand(String command) protected voidvoidstop()Called on aJChannel.disconnect(); stops work (e.g.protected voidprotected voidsuspect(InetAddress host) Called by ping task; will result in all members of host getting suspectedprotected voidprotected booleanprotected voidMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, 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, up, up
-
Field Details
-
cmd
-
timeout
protected long timeout -
interval
protected long interval -
check_timeout
protected long check_timeout -
use_time_service
protected boolean use_time_service -
num_liveness_checks
protected int num_liveness_checks -
num_suspect_events
protected int num_suspect_events -
suspected_mbrs
-
has_suspected_mbrs
protected volatile boolean has_suspected_mbrs -
suspect_history
-
local_host
-
members
-
ping_command
The command to detect whether a target is alive -
hosts
Map of hosts and their cluster members, updated on view changes. Used to suspect all members of a suspected host -
timestamps
-
timer
Timer used to run the ping task on -
time_service
-
ping_task_future
-
-
Constructor Details
-
FD_HOST
public FD_HOST()
-
-
Method Details
-
pingCommand
-
resetStats
public void resetStats()- Overrides:
resetStatsin classProtocol
-
setCommand
-
printSuspectHistory
-
printTimestamps
-
isPingerRunning
public boolean isPingerRunning() -
printHosts
-
isAlive
- Throws:
Exception
-
getSuspectedMembers
-
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(). -
handleView
-
getPhysicalAddress
-
getHostFor
-
isPinger
-
startPingerTask
protected void startPingerTask() -
stopPingerTask
protected void stopPingerTask() -
suspect
Called by ping task; will result in all members of host getting suspected -
suspect
-
unsuspect
-
_printTimestamps
-
updateTimestampFor
-
getAgeOf
Returns the age (in secs) of the given host -
getTimestamp
protected long getTimestamp()
-