public class HeartbeatMonitor extends Object
Constructor and Description |
---|
HeartbeatMonitor(AxonServerConnectionManager connectionManager,
String context)
Constructs an instance of
HeartbeatMonitor that forces a disconnection
when the AxonServer connection is no longer alive. |
HeartbeatMonitor(Runnable onInvalidConnection,
ConnectionSanityChecker connectionSanityCheck,
Scheduler scheduler,
long initialDelay,
long delay)
Primary constructor of
HeartbeatMonitor . |
Modifier and Type | Method and Description |
---|---|
void |
shutdown()
Stops the scheduled task and shutdown the monitor, that cannot be restarted again.
|
void |
start()
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(AxonServerConnectionManager connectionManager, String context)
HeartbeatMonitor
that forces a disconnection
when the AxonServer connection is no longer alive.connectionManager
- connectionManager to AxonServercontext
- the (Bounded) Context for which the heartbeat activity is monitoredpublic HeartbeatMonitor(Runnable onInvalidConnection, ConnectionSanityChecker connectionSanityCheck, Scheduler scheduler, long initialDelay, long delay)
HeartbeatMonitor
.onInvalidConnection
- callback to be call when the connection is no longer aliveconnectionSanityCheck
- sanity check which allows to verify if the connection is alivescheduler
- the Scheduler
to use for scheduling the taskinitialDelay
- the initial delay, in millisecondsdelay
- the scheduling period, in milliseconds@StartHandler(phase=1073741833) public void start()
Phase.INSTRUCTION_COMPONENTS
, as this means all inbound and
outbound connections have been started.@ShutdownHandler(phase=1073741833) public void shutdown()
Phase.INSTRUCTION_COMPONENTS
.Copyright © 2010–2020. All rights reserved.