use of com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl in project hazelcast by hazelcast.
the class MapPublisherCreateWithValueMessageTask method createPublishersAndGetSnapshotOf.
private List<Future> createPublishersAndGetSnapshotOf(Collection<MemberImpl> members) {
List<Future> futures = new ArrayList<Future>(members.size());
OperationServiceImpl operationService = nodeEngine.getOperationService();
for (MemberImpl member : members) {
Predicate predicate = serializationService.toObject(parameters.predicate);
AccumulatorInfo accumulatorInfo = AccumulatorInfo.toAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, true, parameters.populate, parameters.coalesce);
PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
return futures;
}
use of com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl in project hazelcast by hazelcast.
the class AbstractMultiTargetMessageTask method processInternal.
@Override
protected CompletableFuture<Object> processInternal() {
Supplier<Operation> operationSupplier = createOperationSupplier();
Collection<Member> targets = getTargets();
CompletableFuture<Object> finalResult = new CompletableFuture<>();
if (targets.isEmpty()) {
finalResult.complete(EMPTY_MAP);
return finalResult;
}
final OperationServiceImpl operationService = nodeEngine.getOperationService();
MultiTargetCallback callback = new MultiTargetCallback(targets, finalResult);
for (Member target : targets) {
Operation op = operationSupplier.get();
op.setCallerUuid(endpoint.getUuid());
InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, target.getAddress()).setResultDeserialized(false);
InvocationFuture<Object> invocationFuture = builder.invoke();
invocationFuture.whenCompleteAsync(new SingleTargetCallback(target, callback), CALLER_RUNS);
}
return finalResult;
}
use of com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl in project hazelcast by hazelcast.
the class AbstractMultiPartitionMessageTask method processInternal.
@Override
protected CompletableFuture<Map<Integer, Object>> processInternal() {
OperationFactory operationFactory = new OperationFactoryWrapper(createOperationFactory(), endpoint.getUuid());
OperationServiceImpl operationService = nodeEngine.getOperationService();
return operationService.invokeOnPartitionsAsync(getServiceName(), operationFactory, getPartitions());
}
use of com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl in project hazelcast by hazelcast.
the class XAClearRemoteTransactionMessageTask method call.
@Override
protected Object call() throws Exception {
OperationServiceImpl operationService = nodeEngine.getOperationService();
InternalPartitionService partitionService = nodeEngine.getPartitionService();
Data xidData = serializationService.toData(parameters);
Operation op = new ClearRemoteTransactionOperation(xidData);
op.setCallerUuid(endpoint.getUuid());
int partitionId = partitionService.getPartitionId(xidData);
InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, partitionId);
builder.setTryCount(TRY_COUNT).setResultDeserialized(false);
builder.invoke();
return XATransactionClearRemoteCodec.encodeResponse();
}
use of com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl in project hazelcast by hazelcast.
the class RaftService method resetCPSubsystem.
InternalCompletableFuture<Void> resetCPSubsystem() {
checkState(cpSubsystemEnabled, "CP Subsystem is not enabled!");
InternalCompletableFuture<Void> future = newCompletableFuture();
ClusterService clusterService = nodeEngine.getClusterService();
Collection<Member> members = clusterService.getMembers(NON_LOCAL_MEMBER_SELECTOR);
if (!clusterService.isMaster()) {
return complete(future, new IllegalStateException("Only master can reset CP Subsystem!"));
}
if (config.getCPMemberCount() > members.size() + 1) {
return complete(future, new IllegalStateException("Not enough cluster members to reset CP Subsystem! " + "Required: " + config.getCPMemberCount() + ", available: " + (members.size() + 1)));
}
BiConsumer<Void, Throwable> callback = new BiConsumer<Void, Throwable>() {
final AtomicInteger latch = new AtomicInteger(members.size());
volatile Throwable failure;
@Override
public void accept(Void aVoid, Throwable throwable) {
if (throwable == null) {
if (latch.decrementAndGet() == 0) {
if (failure == null) {
future.complete(null);
} else {
complete(future, failure);
}
}
} else {
failure = throwable;
if (latch.decrementAndGet() == 0) {
complete(future, throwable);
}
}
}
};
long seed = newSeed();
logger.warning("Resetting CP Subsystem with groupId seed: " + seed);
resetLocal(seed);
OperationServiceImpl operationService = nodeEngine.getOperationService();
for (Member member : members) {
Operation op = new ResetCPMemberOp(seed);
operationService.<Void>invokeOnTarget(SERVICE_NAME, op, member.getAddress()).whenCompleteAsync(callback);
}
return future;
}
Aggregations