use of com.hazelcast.internal.cluster.impl.operations.ExplicitSuspicionOp in project hazelcast by hazelcast.
the class ClusterServiceImpl method sendExplicitSuspicion.
void sendExplicitSuspicion(MembersViewMetadata endpointMembersViewMetadata) {
Address endpoint = endpointMembersViewMetadata.getMemberAddress();
if (endpoint.equals(node.getThisAddress())) {
logger.warning("Cannot send explicit suspicion for " + endpointMembersViewMetadata + " to itself.");
return;
}
if (!isJoined()) {
if (logger.isFineEnabled()) {
logger.fine("Cannot send explicit suspicion, not joined yet!");
}
return;
}
Version clusterVersion = getClusterVersion();
assert !clusterVersion.isUnknown() : "Cluster version should not be unknown after join!";
Operation op = new ExplicitSuspicionOp(endpointMembersViewMetadata);
nodeEngine.getOperationService().send(op, endpoint);
}
use of com.hazelcast.internal.cluster.impl.operations.ExplicitSuspicionOp in project hazelcast by hazelcast.
the class ClusterDataSerializerHook method createFactory.
@Override
public DataSerializableFactory createFactory() {
ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
constructors[AUTH_FAILURE] = arg -> new AuthenticationFailureOp();
constructors[ADDRESS] = arg -> new Address();
constructors[MEMBER] = arg -> new MemberImpl();
constructors[HEARTBEAT] = arg -> new HeartbeatOp();
constructors[CONFIG_CHECK] = arg -> new ConfigCheck();
constructors[MEMBER_HANDSHAKE] = arg -> new MemberHandshake();
constructors[MEMBER_INFO_UPDATE] = arg -> new MembersUpdateOp();
constructors[FINALIZE_JOIN] = arg -> new FinalizeJoinOp();
constructors[BEFORE_JOIN_CHECK_FAILURE] = arg -> new BeforeJoinCheckFailureOp();
constructors[CHANGE_CLUSTER_STATE] = arg -> new CommitClusterStateOp();
constructors[CONFIG_MISMATCH] = arg -> new ConfigMismatchOp();
constructors[CLUSTER_MISMATCH] = arg -> new ClusterMismatchOp();
constructors[SPLIT_BRAIN_MERGE_VALIDATION] = arg -> new SplitBrainMergeValidationOp();
constructors[JOIN_REQUEST_OP] = arg -> new JoinRequestOp();
constructors[LOCK_CLUSTER_STATE] = arg -> new LockClusterStateOp();
constructors[MASTER_CLAIM] = arg -> new JoinMastershipClaimOp();
constructors[WHOIS_MASTER] = arg -> new WhoisMasterOp();
constructors[MERGE_CLUSTERS] = arg -> new MergeClustersOp();
constructors[POST_JOIN] = arg -> new OnJoinOp();
constructors[ROLLBACK_CLUSTER_STATE] = arg -> new RollbackClusterStateOp();
constructors[MASTER_RESPONSE] = arg -> new MasterResponseOp();
constructors[SHUTDOWN_NODE] = arg -> new ShutdownNodeOp();
constructors[TRIGGER_MEMBER_LIST_PUBLISH] = arg -> new TriggerMemberListPublishOp();
constructors[CLUSTER_STATE_TRANSACTION_LOG_RECORD] = arg -> new ClusterStateTransactionLogRecord();
constructors[MEMBER_INFO] = arg -> new MemberInfo();
constructors[JOIN_MESSAGE] = arg -> new JoinMessage();
constructors[JOIN_REQUEST] = arg -> new JoinRequest();
constructors[MIGRATION_INFO] = arg -> new MigrationInfo();
constructors[MEMBER_VERSION] = arg -> new MemberVersion();
constructors[CLUSTER_STATE_CHANGE] = arg -> new ClusterStateChange();
constructors[SPLIT_BRAIN_JOIN_MESSAGE] = arg -> new SplitBrainJoinMessage();
constructors[VERSION] = arg -> new Version();
constructors[FETCH_MEMBER_LIST_STATE] = arg -> new FetchMembersViewOp();
constructors[EXPLICIT_SUSPICION] = arg -> new ExplicitSuspicionOp();
constructors[MEMBERS_VIEW] = arg -> new MembersView();
constructors[TRIGGER_EXPLICIT_SUSPICION] = arg -> new TriggerExplicitSuspicionOp();
constructors[MEMBERS_VIEW_METADATA] = arg -> new MembersViewMetadata();
constructors[HEARTBEAT_COMPLAINT] = arg -> new HeartbeatComplaintOp();
constructors[PROMOTE_LITE_MEMBER] = arg -> new PromoteLiteMemberOp();
constructors[VECTOR_CLOCK] = arg -> new VectorClock();
constructors[ENDPOINT_QUALIFIER] = arg -> new EndpointQualifier();
return new ArrayDataSerializableFactory(constructors);
}
use of com.hazelcast.internal.cluster.impl.operations.ExplicitSuspicionOp in project hazelcast by hazelcast.
the class ClusterHeartbeatManager method handleHeartbeat.
public void handleHeartbeat(MembersViewMetadata senderMembersViewMetadata, UUID receiverUuid, long timestamp, Collection<MemberInfo> suspectedMembers) {
Address senderAddress = senderMembersViewMetadata.getMemberAddress();
try {
long timeout = Math.min(TimeUnit.SECONDS.toMillis(1), heartbeatIntervalMillis / 2);
if (!clusterServiceLock.tryLock(timeout, MILLISECONDS)) {
logger.warning("Cannot handle heartbeat from " + senderAddress + ", could not acquire lock in time.");
return;
}
} catch (InterruptedException e) {
logger.warning("Cannot handle heartbeat from " + senderAddress + ", thread interrupted.");
Thread.currentThread().interrupt();
return;
}
try {
if (!clusterService.isJoined()) {
if (clusterService.getThisUuid().equals(receiverUuid)) {
logger.fine("Ignoring heartbeat of sender: " + senderMembersViewMetadata + ", because node is not joined!");
} else {
// we know that sender version is 3.9 so we send explicit suspicion back even if we are not joined...
logger.fine("Sending explicit suspicion to " + senderAddress + " for heartbeat " + senderMembersViewMetadata + ", because this node has received an invalid heartbeat before it joins to the cluster");
OperationService operationService = nodeEngine.getOperationService();
Operation op = new ExplicitSuspicionOp(senderMembersViewMetadata);
operationService.send(op, senderAddress);
}
return;
}
MembershipManager membershipManager = clusterService.getMembershipManager();
MemberImpl member = membershipManager.getMember(senderAddress, senderMembersViewMetadata.getMemberUuid());
if (member != null) {
if (clusterService.getThisUuid().equals(receiverUuid)) {
if (onHeartbeat(member, timestamp)) {
// local timestamp is used on purpose here
membershipManager.handleReceivedSuspectedMembers(member, clusterClock.getClusterTime(), suspectedMembers);
}
return;
}
logger.warning("Local UUID mismatch on received heartbeat. local UUID: " + clusterService.getThisUuid() + " received UUID: " + receiverUuid + " with " + senderMembersViewMetadata);
}
onInvalidHeartbeat(senderMembersViewMetadata);
} finally {
clusterServiceLock.unlock();
}
}
Aggregations