Package org.jgroups.protocols
Class FD_HOST
- java.lang.Object
- 
- org.jgroups.stack.Protocol
- 
- org.jgroups.protocols.FD_HOST
 
 
- 
- All Implemented Interfaces:
- Lifecycle
 
 public class FD_HOST extends Protocol 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_ALL3andFD_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
- Author:
- Bela Ban
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classFD_HOST.CommandExecutor2protected static classFD_HOST.ExternalPingCommandstatic classFD_HOST.IsReachablePingCommandstatic interfaceFD_HOST.PingCommandCommand used to check whether a given host is alive, periodically calledprotected classFD_HOST.PingTaskSelected members run this task periodically.
 - 
Field SummaryFields Modifier and Type Field Description protected longcheck_timeoutprotected java.lang.Stringcmdprotected booleanhas_suspected_mbrsprotected java.util.Map<java.net.InetAddress,java.util.List<Address>>hostsMap of hosts and their cluster members, updated on view changes.protected longintervalprotected java.net.InetAddresslocal_hostprotected java.util.List<Address>membersprotected intnum_liveness_checksprotected intnum_suspect_eventsprotected FD_HOST.PingCommandping_commandThe command to detect whether a target is aliveprotected java.util.concurrent.Future<?>ping_task_futureprotected BoundedList<Tuple<java.net.InetAddress,java.lang.Long>>suspect_historyprotected java.util.Set<Address>suspected_mbrsprotected TimeServicetime_serviceprotected longtimeoutprotected TimeSchedulertimerTimer used to run the ping task onprotected java.util.concurrent.ConcurrentMap<java.net.InetAddress,java.lang.Long>timestampsprotected booleanuse_time_service- 
Fields inherited from class org.jgroups.stack.Protocolafter_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot
 
- 
 - 
Constructor SummaryConstructors Constructor Description FD_HOST()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String_printTimestamps()java.lang.Objectdown(Event evt)An event is to be sent down the stack.protected longgetAgeOf(java.net.InetAddress host)Returns the age (in secs) of the given hostprotected java.net.InetAddressgetHostFor(Address mbr)protected PhysicalAddressgetPhysicalAddress(Address logical_addr)java.lang.StringgetSuspectedMembers()protected longgetTimestamp()protected voidhandleView(View view)voidinit()Called after a protocol has been created and before the protocol is started.booleanisAlive(java.lang.String host)protected booleanisPinger(Address mbr)booleanisPingerRunning()FD_HOSTpingCommand(FD_HOST.PingCommand cmd)java.lang.StringprintHosts()java.lang.StringprintSuspectHistory()java.lang.StringprintTimestamps()voidresetStats()FD_HOSTsetCommand(java.lang.String command)protected voidstartPingerTask()voidstop()Called on aJChannel.disconnect(); stops work (e.g.protected voidstopPingerTask()protected voidsuspect(java.net.InetAddress host)Called by ping task; will result in all members of host getting suspectedprotected voidsuspect(java.util.List<Address> suspects)protected booleanunsuspect(Address mbr)protected voidupdateTimestampFor(java.net.InetAddress host)- 
Methods inherited from class org.jgroups.stack.Protocolaccept, 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 Detail- 
cmdprotected java.lang.String cmd 
 - 
timeoutprotected long timeout 
 - 
intervalprotected long interval 
 - 
check_timeoutprotected long check_timeout 
 - 
use_time_serviceprotected boolean use_time_service 
 - 
num_liveness_checksprotected int num_liveness_checks 
 - 
num_suspect_eventsprotected int num_suspect_events 
 - 
suspected_mbrsprotected final java.util.Set<Address> suspected_mbrs 
 - 
has_suspected_mbrsprotected volatile boolean has_suspected_mbrs 
 - 
suspect_historyprotected final BoundedList<Tuple<java.net.InetAddress,java.lang.Long>> suspect_history 
 - 
local_hostprotected java.net.InetAddress local_host 
 - 
membersprotected final java.util.List<Address> members 
 - 
ping_commandprotected FD_HOST.PingCommand ping_command The command to detect whether a target is alive
 - 
hostsprotected final java.util.Map<java.net.InetAddress,java.util.List<Address>> hosts Map of hosts and their cluster members, updated on view changes. Used to suspect all members of a suspected host
 - 
timestampsprotected final java.util.concurrent.ConcurrentMap<java.net.InetAddress,java.lang.Long> timestamps 
 - 
timerprotected TimeScheduler timer Timer used to run the ping task on
 - 
time_serviceprotected TimeService time_service 
 - 
ping_task_futureprotected java.util.concurrent.Future<?> ping_task_future 
 
- 
 - 
Method Detail- 
pingCommandpublic FD_HOST pingCommand(FD_HOST.PingCommand cmd) 
 - 
resetStatspublic void resetStats() - Overrides:
- resetStatsin class- Protocol
 
 - 
setCommandpublic FD_HOST setCommand(java.lang.String command) 
 - 
printSuspectHistorypublic java.lang.String printSuspectHistory() 
 - 
printTimestampspublic java.lang.String printTimestamps() 
 - 
isPingerRunningpublic boolean isPingerRunning() 
 - 
printHostspublic java.lang.String printHosts() 
 - 
isAlivepublic boolean isAlive(java.lang.String host) throws java.lang.Exception- Throws:
- java.lang.Exception
 
 - 
getSuspectedMemberspublic java.lang.String getSuspectedMembers() 
 - 
initpublic 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.
 - 
stoppublic 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.
 - 
downpublic java.lang.Object down(Event evt) 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().
 - 
handleViewprotected void handleView(View view) 
 - 
getPhysicalAddressprotected PhysicalAddress getPhysicalAddress(Address logical_addr) 
 - 
getHostForprotected java.net.InetAddress getHostFor(Address mbr) 
 - 
isPingerprotected boolean isPinger(Address mbr) 
 - 
startPingerTaskprotected void startPingerTask() 
 - 
stopPingerTaskprotected void stopPingerTask() 
 - 
suspectprotected void suspect(java.net.InetAddress host) Called by ping task; will result in all members of host getting suspected
 - 
suspectprotected void suspect(java.util.List<Address> suspects) 
 - 
unsuspectprotected boolean unsuspect(Address mbr) 
 - 
_printTimestampsprotected java.lang.String _printTimestamps() 
 - 
updateTimestampForprotected void updateTimestampFor(java.net.InetAddress host) 
 - 
getAgeOfprotected long getAgeOf(java.net.InetAddress host) Returns the age (in secs) of the given host
 - 
getTimestampprotected long getTimestamp() 
 
- 
 
-