use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class PromotionCommitOperation method finalizePromotion.
/**
* Processes the sent partition state and sends {@link FinalizePromotionOperation} for all promotions.
*/
private void finalizePromotion() {
NodeEngine nodeEngine = getNodeEngine();
InternalPartitionServiceImpl partitionService = getService();
OperationService operationService = nodeEngine.getOperationService();
partitionState.setMaster(getCallerAddress());
success = partitionService.processPartitionRuntimeState(partitionState);
ILogger logger = getLogger();
if (!success) {
logger.severe("Promotion of " + promotions.size() + " partitions failed. " + ". Promotion partition state stamp: " + partitionState.getStamp() + ", current partition state stamp: " + partitionService.getPartitionStateStamp());
}
if (logger.isFineEnabled()) {
logger.fine("Submitting FinalizePromotionOperations for " + promotions.size() + " promotions. Result: " + success + ". Promotion partition state stamp: " + partitionState.getStamp() + ", current partition state stamp: " + partitionService.getPartitionStateStamp());
}
PromotionOperationCallback finalizePromotionsCallback = new FinalizePromotionOperationCallback(this, promotions.size());
for (MigrationInfo promotion : promotions) {
if (logger.isFinestEnabled()) {
logger.finest("Submitting FinalizePromotionOperation for promotion: " + promotion + ". Result: " + success);
}
Operation op = new FinalizePromotionOperation(promotion, success, finalizePromotionsCallback);
op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService);
operationService.execute(op);
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class PartitionReplicaSyncRequest method sendRetryResponse.
/**
* Send a response to the replica to retry the replica sync
*/
protected void sendRetryResponse() {
NodeEngine nodeEngine = getNodeEngine();
int partitionId = partitionId();
int replicaIndex = getReplicaIndex();
PartitionReplicaSyncRetryResponse response = new PartitionReplicaSyncRetryResponse(namespaces);
response.setPartitionId(partitionId).setReplicaIndex(replicaIndex);
Address target = getCallerAddress();
OperationService operationService = nodeEngine.getOperationService();
operationService.send(response, target);
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class MemberSchemaService method searchClusterAsync.
private CompletableFuture<Schema> searchClusterAsync(long schemaId, Iterator<Member> iterator, OperationService operationService) {
if (!iterator.hasNext()) {
return CompletableFuture.completedFuture(null);
}
Address address = iterator.next().getAddress();
FetchSchemaOperation op = new FetchSchemaOperation(schemaId);
InvocationFuture<Schema> future = operationService.invokeOnTarget(SERVICE_NAME, op, address);
return future.handle((data, throwable) -> {
// handle the exception and carry it to next `thenCompose` method
if (throwable != null) {
return throwable;
}
return data;
}).thenCompose(o -> {
if (o instanceof Throwable || o == null) {
return searchClusterAsync(schemaId, iterator, operationService);
}
Schema retrievedSchema = (Schema) o;
putLocal(retrievedSchema);
return CompletableFuture.completedFuture(getLocal(schemaId));
});
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class MemberSchemaService method getAsync.
public CompletableFuture<Schema> getAsync(long schemaId) {
if (!nodeEngine.getClusterService().getClusterVersion().isEqualTo(Versions.V5_2)) {
throw new UnsupportedOperationException("The BETA compact format can only be used with 5.2 cluster");
}
Schema schema = getLocal(schemaId);
if (schema != null) {
return CompletableFuture.completedFuture(schema);
}
if (logger.isFinestEnabled()) {
logger.finest("Could not find schema id " + schemaId + " locally, will search on the cluster" + schemaId);
}
ClusterService cluster = nodeEngine.getClusterService();
OperationService operationService = nodeEngine.getOperationService();
Set<Member> members = cluster.getMembers();
Iterator<Member> iterator = members.iterator();
return searchClusterAsync(schemaId, iterator, operationService);
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ClassLocator method tryToFetchClassDataFromMember.
private ClassData tryToFetchClassDataFromMember(String className, Member member) throws ExecutionException, InterruptedException {
OperationService operationService = nodeEngine.getOperationService();
ClassDataFinderOperation op = new ClassDataFinderOperation(className);
Future<ClassData> classDataFuture = operationService.invokeOnTarget(UserCodeDeploymentService.SERVICE_NAME, op, member.getAddress());
return classDataFuture.get();
}
Aggregations