use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MembershipManager method onMemberRemove.
void onMemberRemove(MemberImpl... deadMembers) {
if (deadMembers.length == 0) {
return;
}
// sync calls
node.getPartitionService().memberRemoved(deadMembers);
for (MemberImpl deadMember : deadMembers) {
nodeEngine.onMemberLeft(deadMember);
}
node.getNodeExtension().onMemberListChange();
}
use of com.hazelcast.cluster.impl.MemberImpl 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);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class LockSupportServiceImpl method memberRemoved.
@Override
public void memberRemoved(MembershipServiceEvent event) {
final MemberImpl member = event.getMember();
final UUID uuid = member.getUuid();
releaseLocksOwnedBy(uuid);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class PartitionReplicaStateChecker method invokeReplicaSyncOperations.
@SuppressWarnings("checkstyle:npathcomplexity")
private int invokeReplicaSyncOperations(int maxBackupCount, Semaphore semaphore, AtomicBoolean result) {
MemberImpl localMember = node.getLocalMember();
BiConsumer<Object, Throwable> callback = new ReplicaSyncResponseCallback(result, semaphore);
ClusterServiceImpl clusterService = node.getClusterService();
ClusterState clusterState = clusterService.getClusterState();
int ownedCount = 0;
for (InternalPartition partition : partitionStateManager.getPartitions()) {
PartitionReplica owner = partition.getOwnerReplicaOrNull();
if (owner == null) {
result.set(false);
continue;
}
if (!owner.isIdentical(localMember)) {
continue;
}
ownedCount++;
if (maxBackupCount == 0) {
if (partition.isMigrating()) {
result.set(false);
}
continue;
}
for (int index = 1; index <= maxBackupCount; index++) {
PartitionReplica replicaOwner = partition.getReplica(index);
if (replicaOwner == null) {
result.set(false);
semaphore.release();
continue;
}
// because to be able to change cluster state, we ensure that there are no ongoing/pending migrations
if (!clusterState.isJoinAllowed() && clusterService.isMissingMember(replicaOwner.address(), replicaOwner.uuid())) {
semaphore.release();
continue;
}
int partitionId = partition.getPartitionId();
PartitionSpecificRunnable task = new CheckPartitionReplicaVersionTask(nodeEngine, partitionId, index, callback);
nodeEngine.getOperationService().execute(task);
}
}
return ownedCount;
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class TopicService method dispatchEvent.
@Override
public void dispatchEvent(Object event, Object listener) {
TopicEvent topicEvent = (TopicEvent) event;
ClusterService clusterService = nodeEngine.getClusterService();
MemberImpl member = clusterService.getMember(topicEvent.publisherAddress);
if (member == null) {
member = new MemberImpl.Builder(topicEvent.publisherAddress).version(nodeEngine.getVersion()).build();
}
Message message = new DataAwareMessage(topicEvent.name, topicEvent.data, topicEvent.publishTime, member, nodeEngine.getSerializationService());
incrementReceivedMessages(topicEvent.name);
MessageListener messageListener = (MessageListener) listener;
messageListener.onMessage(message);
}
Aggregations