public class HeartbeatMonitor extends Object
| Constructor and Description |
|---|
HeartbeatMonitor(ScheduledExecutorService executor,
HeartbeatSender heartbeatSender,
Runnable onConnectionCorrupted)
Constructs a
HeartbeatMonitor. |
| Modifier and Type | Method and Description |
|---|---|
void |
disableHeartbeat()
Turn off heartbeat sending by this
HeartbeatMonitor. |
void |
enableHeartbeat(long interval,
long timeout,
TimeUnit timeUnit)
Turn on heartbeat sending by this
HeartbeatMonitor. |
void |
handleIncomingBeat(ReplyChannel<PlatformInboundInstruction> reply)
Handler of
PlatformInboundInstruction requesting a heartbeat from this connector. |
void |
pause()
Pause the process of sending out heartbeats by this monitor.
|
void |
resume()
Resume the process of sending out heartbeats by this monitor.
|
public HeartbeatMonitor(ScheduledExecutorService executor, HeartbeatSender heartbeatSender, Runnable onConnectionCorrupted)
HeartbeatMonitor.executor - the ScheduledExecutorService used to schedule operations to validate if a
heartbeat should be send with the given heartbeatSenderheartbeatSender - the HeartbeatSender used to send heartbeats withonConnectionCorrupted - operation to perform if a heartbeat has been missed. Can be used to force a
reconnect of a channel for examplepublic void enableHeartbeat(long interval,
long timeout,
TimeUnit timeUnit)
HeartbeatMonitor.interval - the interval at which heartbeats occur. Will use a minimal value of 500 milliseconds to
reschedule heartbeat validationtimeout - the timeout within which this monitor expects responses to the dispatched heartbeats. If this
timeout is hit, the given onHeartbeatMissed on construction will be calledtimeUnit - the TimeUnit used to define in which time frame both the given interval and
timeout reside. Will be used to change both values to their representative in
millisecondspublic void disableHeartbeat()
HeartbeatMonitor.public void pause()
public void resume()
public void handleIncomingBeat(ReplyChannel<PlatformInboundInstruction> reply)
PlatformInboundInstruction requesting a heartbeat from this connector. The given
ReplyChannel is used to send responding heartbeat message with.reply - the ReplyChannel to send a heartbeat reply message overCopyright © 2020–2023 AxonIQ BV. All rights reserved.