private Future<Boolean> invokeCancelOperation(boolean mayInterruptIfRunning) { CancellationOperation op = new CancellationOperation(uuid, mayInterruptIfRunning); OperationService opService = nodeEngine.getOperationService(); InvocationBuilder builder; if (partitionId > -1) { builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, partitionId); } else { builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, target); } builder.setTryCount(CANCEL_TRY_COUNT).setTryPauseMillis(CANCEL_TRY_PAUSE_MILLIS); return builder.invoke(); }
public InternalCompletableFuture<Object> callOnAddress(Address address, Operation operation) { // TODO: why are we always executing on the MapService? OperationService operationService = instance.node.nodeEngine.getOperationService(); return operationService.invokeOnTarget(MapService.SERVICE_NAME, operation, address); }
@Override public void run() { Operation op = new TriggerLoadIfNeededOperation(mapName); opService.invokeOnPartition(SERVICE_NAME, op, mapNamePartition); } };
private Future invoke(NodeEngine nodeEngine, TransactionLogRecord record, Operation op) { OperationService operationService = nodeEngine.getOperationService(); if (record instanceof TargetAwareTransactionLogRecord) { Address target = ((TargetAwareTransactionLogRecord) record).getTarget(); return operationService.invokeOnTarget(op.getServiceName(), op, target); } return operationService.invokeOnPartition(op.getServiceName(), op, op.getPartitionId()); }
private void invokeOnAllMembers(Supplier<Operation> operationSupplier) { NodeEngineImpl nodeEngine = instance.node.nodeEngine; OperationService os = nodeEngine.getOperationService(); try { for (Member member : nodeEngine.getClusterService().getMembers()) { if (!member.localMember()) { os.invokeOnTarget(ClusterServiceImpl.SERVICE_NAME, operationSupplier.get(), member.getAddress()); } else { os.execute(operationSupplier.get()); } } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } }
@Override public Map<Integer, Object> invokeOnAllPartitions(Object request) throws Exception { checkInstanceOf(OperationFactory.class, request, "request"); OperationFactory factory = (OperationFactory) request; return operationService.invokeOnAllPartitions(MapService.SERVICE_NAME, factory); }
protected void removeAllInternal(Predicate predicate) { try { if (predicate instanceof PartitionPredicate) { PartitionPredicate partitionPredicate = (PartitionPredicate) predicate; OperationFactory operation = operationProvider .createPartitionWideEntryWithPredicateOperationFactory(name, ENTRY_REMOVING_PROCESSOR, partitionPredicate.getTarget()); Data partitionKey = toDataWithStrategy(partitionPredicate.getPartitionKey()); int partitionId = partitionService.getPartitionId(partitionKey); // invokeOnPartitions is used intentionally here, instead of invokeOnPartition, since // the later one doesn't support PartitionAwareOperationFactory, which we need to use // to speed up the removal operation using global indexes // (see PartitionWideEntryWithPredicateOperationFactory.createFactoryOnRunner). operationService.invokeOnPartitions(SERVICE_NAME, operation, singletonList(partitionId)); } else { OperationFactory operation = operationProvider .createPartitionWideEntryWithPredicateOperationFactory(name, ENTRY_REMOVING_PROCESSOR, predicate); operationService.invokeOnAllPartitions(SERVICE_NAME, operation); } } catch (Throwable t) { throw rethrow(t); } }
@Override public void executeOperation(Operation operation) { checkNotNull(operation, "operation cannot be null"); operationService.execute(operation); } }
private Map<Integer, Object> retryPartitions(Collection<Integer> partitions, OperationFactory operationFactory) { try { return operationService.invokeOnPartitions(SERVICE_NAME, operationFactory, partitions); } catch (Throwable t) { throw rethrow(t); } }
@Override public Long call() throws Exception { try { OperationService operationService = HazelcastTestUtils.getOperationService(hz); return operationService.getExecutedOperationCount(); } catch (NoSuchMethodError e) { LOGGER.warning(e); return -1L; } }
private Future invoke(NodeEngine nodeEngine, TransactionLogRecord record, Operation op) { OperationService operationService = nodeEngine.getOperationService(); if (record instanceof TargetAwareTransactionLogRecord) { Address target = ((TargetAwareTransactionLogRecord) record).getTarget(); return operationService.invokeOnTarget(op.getServiceName(), op, target); } return operationService.invokeOnPartition(op.getServiceName(), op, op.getPartitionId()); }
private void invokeOnAllMembers(Supplier<Operation> operationSupplier) { NodeEngineImpl nodeEngine = instance.node.nodeEngine; OperationService os = nodeEngine.getOperationService(); try { for (Member member : nodeEngine.getClusterService().getMembers()) { if (!member.localMember()) { os.invokeOnTarget(ClusterServiceImpl.SERVICE_NAME, operationSupplier.get(), member.getAddress()); } else { os.execute(operationSupplier.get()); } } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } }
@Override public Map<Integer, Object> invokeOnAllPartitions(Object request) throws Exception { checkInstanceOf(OperationFactory.class, request, "request"); OperationFactory factory = (OperationFactory) request; return operationService.invokeOnAllPartitions(MapService.SERVICE_NAME, factory); }
results = operationService.invokeOnPartitions(SERVICE_NAME, operation, Collections.singletonList(partitionId)); } else { OperationFactory operation = operationProvider.createPartitionWideEntryWithPredicateOperationFactory( name, entryProcessor, predicate); results = operationService.invokeOnAllPartitions(SERVICE_NAME, operation);
@Override public void executeOperation(Operation operation) { checkNotNull(operation, "operation cannot be null"); operationService.execute(operation); } }
private Map<Integer, Object> retryPartitions(Collection<Integer> partitions, OperationFactory operationFactory) { try { return operationService.invokeOnPartitions(SERVICE_NAME, operationFactory, partitions); } catch (Throwable t) { throw rethrow(t); } }
@Override public Long call() throws Exception { try { OperationService operationService = HazelcastTestUtils.getOperationService(hz); return operationService.getExecutedOperationCount(); } catch (NoSuchMethodError e) { LOGGER.warning(e); return -1L; } }
private Future<Boolean> invokeCancelOperation(boolean mayInterruptIfRunning) { CancellationOperation op = new CancellationOperation(uuid, mayInterruptIfRunning); OperationService opService = nodeEngine.getOperationService(); InvocationBuilder builder; if (partitionId > -1) { builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, partitionId); } else { builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, target); } builder.setTryCount(CANCEL_TRY_COUNT).setTryPauseMillis(CANCEL_TRY_PAUSE_MILLIS); return builder.invoke(); }
private List<Future<Result>> dispatchFullQueryOnAllMembersOnQueryThread(Query query) { Collection<Member> members = clusterService.getMembers(DATA_MEMBER_SELECTOR); List<Future<Result>> futures = new ArrayList<Future<Result>>(members.size()); for (Member member : members) { Operation operation = createQueryOperation(query); Future<Result> future = operationService.invokeOnTarget( MapService.SERVICE_NAME, operation, member.getAddress()); futures.add(future); } return futures; }
@Override public void run() { // checks if loading has finished and triggers loading in case SENDER died and SENDER_BACKUP took over. Operation op = new TriggerLoadIfNeededOperation(mapName); opService.<Boolean>invokeOnPartition(SERVICE_NAME, op, mapNamePartition) // required since loading may be triggered after migration // and in this case the callback is the only way to get to know if the key load finished or not. .andThen(loadingFinishedCallback()); } });