use of cern.laser.client.services.selection.LaserHeartbeatException in project ACS by ACS-Community.
the class HeartbeatHelper method checkHeartbeat.
private void checkHeartbeat() {
if (LOGGER.isDebugEnabled())
LOGGER.debug("checking heartbeat reception...");
long now = System.currentTimeMillis();
long heartbeatWaitTime = now - getHeartbeatReceptionTime();
if (heartbeatWaitTime > heartbeatFrequency) {
if (isHeartbeatReceived()) {
if (selectionListener != null) {
selectionListener.onException(new LaserHeartbeatException(LaserHeartbeatException.HEARTBEAT_LOST));
}
setHeartbeatReceived(false);
}
} else {
if (!isHeartbeatReceived()) {
if (selectionListener != null) {
selectionListener.onException(new LaserHeartbeatException(LaserHeartbeatException.HEARTBEAT_RECONNECTED));
}
setHeartbeatReceived(true);
}
}
if (LOGGER.isDebugEnabled())
LOGGER.debug("heartbeat reception checked (wait time " + heartbeatWaitTime + ")");
}
Aggregations