use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class PartitionReplicaSyncRequestOffloadable method readReplicaVersions.
private void readReplicaVersions() {
InternalPartitionServiceImpl partitionService = getService();
OperationService operationService = getNodeEngine().getOperationService();
PartitionReplicaVersionManager versionManager = partitionService.getPartitionReplicaVersionManager();
UrgentPartitionRunnable<Void> gatherReplicaVersionsRunnable = new UrgentPartitionRunnable<>(partitionId(), () -> {
for (ServiceNamespace ns : namespaces) {
// make a copy because
// getPartitionReplicaVersions
// returns references to the internal
// replica versions data structures
// that may change under our feet
long[] versions = Arrays.copyOf(versionManager.getPartitionReplicaVersions(partitionId(), ns), IPartition.MAX_BACKUP_COUNT);
replicaVersions.put(BiTuple.of(partitionId(), ns), versions);
}
});
operationService.execute(gatherReplicaVersionsRunnable);
gatherReplicaVersionsRunnable.future.joinInternal();
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class CacheDestroyOperation method destroyCacheOnAllMembers.
private void destroyCacheOnAllMembers(String name, UUID callerUuid) {
NodeEngine nodeEngine = getNodeEngine();
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
for (Member member : members) {
if (!member.localMember() && !member.getUuid().equals(callerUuid)) {
CacheDestroyOperation op = new CacheDestroyOperation(name, true);
operationService.invokeOnTarget(ICacheService.SERVICE_NAME, op, member.getAddress());
}
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ClientEngineImpl method getClientsInCluster.
Map<UUID, String> getClientsInCluster() {
OperationService operationService = node.nodeEngine.getOperationService();
Map<UUID, String> clientsMap = new HashMap<>();
for (Member member : node.getClusterService().getMembers()) {
Address target = member.getAddress();
Operation clientInfoOperation = new GetConnectedClientsOperation();
Future<Map<UUID, String>> future = operationService.invokeOnTarget(SERVICE_NAME, clientInfoOperation, target);
try {
Map<UUID, String> endpoints = future.get();
if (endpoints == null) {
continue;
}
// Merge connected clients according to their UUID
clientsMap.putAll(endpoints);
} catch (Exception e) {
logger.warning("Cannot get client information from: " + target.toString(), e);
}
}
return clientsMap;
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ClusterJoinManager method ensureValidConfiguration.
private boolean ensureValidConfiguration(JoinMessage joinMessage) {
Address address = joinMessage.getAddress();
try {
if (isValidJoinMessage(joinMessage)) {
return true;
}
logger.warning(format("Received an invalid join request from %s, cause: members part of different cluster", address));
nodeEngine.getOperationService().send(new ClusterMismatchOp(), address);
} catch (ConfigMismatchException e) {
logger.warning(format("Received an invalid join request from %s, cause: %s", address, e.getMessage()));
OperationService operationService = nodeEngine.getOperationService();
operationService.send(new ConfigMismatchOp(e.getMessage()), address);
}
return false;
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ClusterJoinManager method checkClusterStateBeforeJoin.
private boolean checkClusterStateBeforeJoin(Address target, UUID uuid) {
ClusterState state = clusterStateManager.getState();
if (state == ClusterState.IN_TRANSITION) {
logger.warning("Cluster state is in transition process. Join is not allowed until " + "transaction is completed -> " + clusterStateManager.stateToString());
return true;
}
if (state.isJoinAllowed()) {
return checkRecentlyJoinedMemberUuidBeforeJoin(target, uuid);
}
if (clusterService.isMissingMember(target, uuid)) {
return false;
}
if (node.getNodeExtension().isStartCompleted()) {
String message = "Cluster state either is locked or doesn't allow new members to join -> " + clusterStateManager.stateToString();
logger.warning(message);
OperationService operationService = nodeEngine.getOperationService();
BeforeJoinCheckFailureOp op = new BeforeJoinCheckFailureOp(message);
operationService.send(op, target);
} else {
String message = "Cluster state either is locked or doesn't allow new members to join -> " + clusterStateManager.stateToString() + ". Silently ignored join request of " + target + " because start not completed.";
logger.warning(message);
}
return true;
}
Aggregations