use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class MemberAttributeChangedOperation method run.
@Override
public void run() throws Exception {
final ClusterServiceImpl cs = getService();
cs.updateMemberAttribute(getCallerUuid(), operationType, key, value);
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class MemberInfoUpdateOperation method run.
@Override
public void run() throws Exception {
checkLocalMemberUuid();
ClusterServiceImpl clusterService = getService();
Address callerAddress = getConnectionEndpointOrThisAddress();
if (clusterService.updateMembers(memberInfos, callerAddress)) {
processPartitionState();
}
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class MemberInfoUpdateOperation method getConnectionEndpointOrThisAddress.
final Address getConnectionEndpointOrThisAddress() {
ClusterServiceImpl clusterService = getService();
NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
Node node = nodeEngine.getNode();
Connection conn = getConnection();
return conn != null ? conn.getEndPoint() : node.getThisAddress();
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class InternalPartitionServiceImpl method searchUnknownAddressesInPartitionTable.
private void searchUnknownAddressesInPartitionTable(Address sender, Set<Address> unknownAddresses, int partitionId, Address[] addresses) {
final ClusterServiceImpl clusterService = node.clusterService;
final ClusterState clusterState = clusterService.getClusterState();
for (int index = 0; index < InternalPartition.MAX_REPLICA_COUNT; index++) {
Address address = addresses[index];
if (address != null && node.clusterService.getMember(address) == null) {
if (clusterState == ClusterState.ACTIVE || !clusterService.isMemberRemovedWhileClusterIsNotActive(address)) {
if (logger.isFinestEnabled()) {
logger.finest("Unknown " + address + " found in partition table sent from master " + sender + ". It has probably already left the cluster. partitionId=" + partitionId);
}
unknownAddresses.add(address);
}
}
}
}
use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.
the class PartitionReplicaStateChecker method invokeReplicaSyncOperations.
@SuppressWarnings("checkstyle:npathcomplexity")
private int invokeReplicaSyncOperations(int maxBackupCount, Semaphore semaphore, AtomicBoolean result) {
Address thisAddress = node.getThisAddress();
ExecutionCallback<Object> callback = new ReplicaSyncResponseCallback(result, semaphore);
ClusterServiceImpl clusterService = node.getClusterService();
ClusterState clusterState = clusterService.getClusterState();
boolean isClusterActive = clusterState == ClusterState.ACTIVE || clusterState == ClusterState.IN_TRANSITION;
int ownedCount = 0;
for (InternalPartition partition : partitionStateManager.getPartitions()) {
Address owner = partition.getOwnerOrNull();
if (owner == null) {
result.set(false);
continue;
}
if (!thisAddress.equals(owner)) {
continue;
}
ownedCount++;
if (maxBackupCount == 0) {
if (partition.isMigrating()) {
result.set(false);
}
continue;
}
for (int index = 1; index <= maxBackupCount; index++) {
Address replicaAddress = partition.getReplicaAddress(index);
if (replicaAddress == null) {
result.set(false);
semaphore.release();
continue;
}
if (!isClusterActive && clusterService.isMemberRemovedWhileClusterIsNotActive(replicaAddress)) {
semaphore.release();
continue;
}
CheckReplicaVersionTask task = new CheckReplicaVersionTask(nodeEngine, partitionService, partition.getPartitionId(), index, callback);
nodeEngine.getOperationService().execute(task);
}
}
return ownedCount;
}
Aggregations