Search in sources :

Example 1 with ClusterHeartbeatManager

use of com.hazelcast.internal.cluster.impl.ClusterHeartbeatManager in project hazelcast by hazelcast.

the class MemberHeartbeatPlugin method render.

private void render(DiagnosticsLogWriter writer, ClusterServiceImpl clusterService) {
    ClusterHeartbeatManager clusterHeartbeatManager = clusterService.getClusterHeartbeatManager();
    long expectedIntervalMillis = clusterHeartbeatManager.getHeartbeatIntervalMillis();
    long nowMillis = System.currentTimeMillis();
    for (MemberImpl member : clusterService.getMemberImpls()) {
        long lastHeartbeatMillis = clusterHeartbeatManager.getLastHeartbeatTime(member);
        if (lastHeartbeatMillis == 0L) {
            // member without a heartbeat; lets skip it
            continue;
        }
        long noHeartbeatMillis = nowMillis - lastHeartbeatMillis;
        float deviation = HUNDRED * ((float) (noHeartbeatMillis - expectedIntervalMillis)) / expectedIntervalMillis;
        if (deviation >= maxDeviationPercentage) {
            startLazyMainSection(writer);
            writer.startSection("member" + member.getAddress());
            writer.writeKeyValueEntry("deviation(%)", deviation);
            writer.writeKeyValueEntry("noHeartbeat(ms)", noHeartbeatMillis);
            writer.writeKeyValueEntry("lastHeartbeat(ms)", lastHeartbeatMillis);
            writer.writeKeyValueEntryAsDateTime("lastHeartbeat(date-time)", lastHeartbeatMillis);
            writer.writeKeyValueEntry("now(ms)", nowMillis);
            writer.writeKeyValueEntryAsDateTime("now(date-time)", nowMillis);
            writer.endSection();
        }
    }
    endLazyMainSection(writer);
}
Also used : ClusterHeartbeatManager(com.hazelcast.internal.cluster.impl.ClusterHeartbeatManager) MemberImpl(com.hazelcast.cluster.impl.MemberImpl)

Example 2 with ClusterHeartbeatManager

use of com.hazelcast.internal.cluster.impl.ClusterHeartbeatManager in project hazelcast by hazelcast.

the class HeartbeatComplaintOp method run.

@Override
public void run() throws Exception {
    ClusterServiceImpl service = getService();
    ClusterHeartbeatManager heartbeatManager = service.getClusterHeartbeatManager();
    heartbeatManager.handleHeartbeatComplaint(receiverMembersViewMetadata, senderMembersViewMetadata);
}
Also used : ClusterHeartbeatManager(com.hazelcast.internal.cluster.impl.ClusterHeartbeatManager) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl)

Example 3 with ClusterHeartbeatManager

use of com.hazelcast.internal.cluster.impl.ClusterHeartbeatManager in project hazelcast by hazelcast.

the class HeartbeatOp method run.

@Override
public void run() {
    ClusterServiceImpl service = getService();
    ClusterHeartbeatManager heartbeatManager = service.getClusterHeartbeatManager();
    heartbeatManager.handleHeartbeat(senderMembersViewMetadata, targetUuid, timestamp, suspectedMembers);
}
Also used : ClusterHeartbeatManager(com.hazelcast.internal.cluster.impl.ClusterHeartbeatManager) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl)

Aggregations

ClusterHeartbeatManager (com.hazelcast.internal.cluster.impl.ClusterHeartbeatManager)3 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)2 MemberImpl (com.hazelcast.cluster.impl.MemberImpl)1