public class HeartbeatMonitor extends Object implements IHeartbeatMonitor
| Modifier and Type | Field and Description |
|---|---|
static int |
HEARTBEAT_INTERVAL |
static int |
HEARTBEAT_INTERVAL_MAX |
| Constructor and Description |
|---|
HeartbeatMonitor() |
| Modifier and Type | Method and Description |
|---|---|
Runnable |
getHeartbeatRunnable() |
int |
getInterval()
Returns the heartbeat messages interval.
|
IHeartbeatMonitorListener |
getListener()
Returns the listener.
|
void |
heartbeatACKReceived()
Notifies the monitor about a received heartbeat ACK message.
|
void |
heartbeatReceived()
Notifies the monitor about a received heartbeat message.
|
boolean |
isHeartbeatReceived() |
void |
notifyTransportActivity()
Notifies the monitor about sent/received messages.
|
void |
setInterval(int value)
Sets the interval for sending heartbeat messages if nothing is sent over
transport.
|
void |
setListener(IHeartbeatMonitorListener value)
Sets the heartbeat's listener.
|
void |
start()
Starts the monitor.
|
void |
stop()
Stops the monitor.
|
public static final int HEARTBEAT_INTERVAL
public static final int HEARTBEAT_INTERVAL_MAX
public Runnable getHeartbeatRunnable()
public boolean isHeartbeatReceived()
public void start()
IHeartbeatMonitorstart in interface IHeartbeatMonitorpublic void stop()
IHeartbeatMonitorstop in interface IHeartbeatMonitorpublic int getInterval()
IHeartbeatMonitorgetInterval in interface IHeartbeatMonitorpublic void setInterval(int value)
IHeartbeatMonitorsetInterval in interface IHeartbeatMonitorvalue - interval in milliseconds (min/max values depend on
concrete implementations)public IHeartbeatMonitorListener getListener()
IHeartbeatMonitorgetListener in interface IHeartbeatMonitorpublic void setListener(IHeartbeatMonitorListener value)
IHeartbeatMonitorsetListener in interface IHeartbeatMonitorvalue - the new listenerpublic void notifyTransportActivity()
IHeartbeatMonitornotifyTransportActivity in interface IHeartbeatMonitorpublic void heartbeatACKReceived()
IHeartbeatMonitorheartbeatACKReceived in interface IHeartbeatMonitorpublic void heartbeatReceived()
IHeartbeatMonitorheartbeatReceived in interface IHeartbeatMonitor