@Deprecated public class HeartbeatMonitor extends Object implements Lifecycle
|Constructor and Description|
Primary constructor of
|Modifier and Type||Method and Description|
Registers the activities to be executed in the various phases of an application's lifecycle.
Stops the scheduled task and shutdown the monitor, that cannot be restarted again.
Schedule a task that verifies that the connection is still alive and, if it is not, invoke a callback in order to react to the disconnection.
public HeartbeatMonitor(Runnable onInvalidConnection, ConnectionSanityChecker connectionSanityCheck, Scheduler scheduler, long initialDelay, long delay)
onInvalidConnection- callback to be call when the connection is no longer alive
connectionSanityCheck- sanity check which allows to verify if the connection is alive
Schedulerto use for scheduling the task
initialDelay- the initial delay, in milliseconds
delay- the scheduling period, in milliseconds
public void registerLifecycleHandlers(@Nonnull Lifecycle.LifecycleRegistry lifecycle)
lifecycle- the lifecycle instance to register the handlers with
public void start()
Phase.INSTRUCTION_COMPONENTS, as this means all inbound and outbound connections have been started.
public void shutdown()
Copyright © 2010–2023. All rights reserved.