| | |
| | | |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugInfo; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | |
| | | import java.io.IOException; |
| | | |
| | |
| | | */ |
| | | public class HeartbeatMonitor extends DirectoryThread |
| | | { |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugInfo("Heartbeat monitor is starting, expected interval is %d", |
| | | TRACER.debugInfo("Heartbeat monitor is starting, expected interval is %d", |
| | | heartbeatInterval); |
| | | } |
| | | try |
| | |
| | | long lastReceiveTime = session.getLastReceiveTime(); |
| | | if (now > lastReceiveTime + 2 * heartbeatInterval) |
| | | { |
| | | debugInfo("Heartbeat monitor is closing the broker session " + |
| | | TRACER.debugInfo("Heartbeat monitor is closing the broker session " + |
| | | "because it could not detect a heartbeat."); |
| | | |
| | | // Heartbeat is well overdue so the server is assumed to be dead. |
| | | if (debugEnabled()) |
| | | { |
| | | debugInfo("Heartbeat monitor is closing the broker session " + |
| | | "because it could not detect a heartbeat."); |
| | | TRACER.debugInfo("Heartbeat monitor is closing the broker " + |
| | | "session because it could not detect a heartbeat."); |
| | | } |
| | | session.close(); |
| | | break; |
| | |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | debugInfo("Heartbeat monitor is exiting."); |
| | | TRACER.debugInfo("Heartbeat monitor is exiting."); |
| | | } |
| | | } |
| | | } |