Package org.apache.pekko.remote
Class DeadlineFailureDetector
java.lang.Object
org.apache.pekko.remote.DeadlineFailureDetector
- All Implemented Interfaces:
FailureDetector
Implementation of failure detector using an absolute timeout of missing heartbeats
to trigger unavailability.
isAvailable() will return false if there is no heartbeat() within the duration
heartbeatInterval + acceptableHeartbeatPause.
param: acceptableHeartbeatPause Duration corresponding to number of potentially lost/delayed heartbeats that will be accepted before considering it to be an anomaly.
param: heartbeatInterval Expected heartbeat interval
param: clock The clock, returning current time in milliseconds, but can be faked for testing purposes. It is only used for measuring intervals (duration).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.pekko.remote.FailureDetector
FailureDetector.Clock -
Constructor Summary
ConstructorsConstructorDescriptionDeadlineFailureDetector(com.typesafe.config.Config config, EventStream ev) Constructor that reads parameters from config.DeadlineFailureDetector(scala.concurrent.duration.FiniteDuration acceptableHeartbeatPause, scala.concurrent.duration.FiniteDuration heartbeatInterval, FailureDetector.Clock clock) -
Method Summary
Modifier and TypeMethodDescriptionscala.concurrent.duration.FiniteDurationfinal voidNotifies the FailureDetector that a heartbeat arrived from the monitored resource.scala.concurrent.duration.FiniteDurationbooleanReturns true if the resource is considered to be up and healthy and returns false otherwise.booleanReturns true if the failure detector has received any heartbeats and started monitoring of the resource.
-
Constructor Details
-
DeadlineFailureDetector
public DeadlineFailureDetector(scala.concurrent.duration.FiniteDuration acceptableHeartbeatPause, scala.concurrent.duration.FiniteDuration heartbeatInterval, FailureDetector.Clock clock) -
DeadlineFailureDetector
Constructor that reads parameters from config. Expecting config properties namedacceptable-heartbeat-pause.
-
-
Method Details
-
acceptableHeartbeatPause
public scala.concurrent.duration.FiniteDuration acceptableHeartbeatPause() -
heartbeat
public final void heartbeat()Description copied from interface:FailureDetectorNotifies the FailureDetector that a heartbeat arrived from the monitored resource. This causes the FailureDetector to update its state.- Specified by:
heartbeatin interfaceFailureDetector
-
heartbeatInterval
public scala.concurrent.duration.FiniteDuration heartbeatInterval() -
isAvailable
public boolean isAvailable()Description copied from interface:FailureDetectorReturns true if the resource is considered to be up and healthy and returns false otherwise.- Specified by:
isAvailablein interfaceFailureDetector
-
isMonitoring
public boolean isMonitoring()Description copied from interface:FailureDetectorReturns true if the failure detector has received any heartbeats and started monitoring of the resource.- Specified by:
isMonitoringin interfaceFailureDetector
-