private ToBackupSender(String serviceName, IBiFunction<RS, Collection<ExpiredKey>, Operation> backupOpSupplier, IBiFunction<Integer, Integer, Boolean> backupOpFilter, NodeEngine nodeEngine) { this.serviceName = serviceName; this.backupOpFilter = backupOpFilter; this.backupOpSupplier = backupOpSupplier; this.operationService = nodeEngine.getOperationService(); }
/** Reruns this operation with {@link #beforeStateCompleted} set to {@code true}. */ private void onBeforePromotionsComplete() { beforeStateCompleted = true; getNodeEngine().getOperationService().execute(this); }
private Object invokeAndGetData(QueueOperation operation) { final NodeEngine nodeEngine = getNodeEngine(); try { OperationService operationService = nodeEngine.getOperationService(); Future f = operationService.invokeOnPartition(QueueService.SERVICE_NAME, operation, partitionId); return f.get(); } catch (Throwable throwable) { throw ExceptionUtil.rethrow(throwable); } }
/** * Read and reset the accumulator of query cache inside the given partition. */ private Future<Object> readAndResetAccumulator(String mapName, String cacheId, Integer partitionId) { Operation operation = new ReadAndResetAccumulatorOperation(mapName, cacheId); OperationService operationService = getNodeEngine().getOperationService(); return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId); }
TransactionalMultiMapProxySupport(NodeEngine nodeEngine, MultiMapService service, String name, Transaction tx) { super(nodeEngine, service, tx); this.name = name; this.config = nodeEngine.getConfig().findMultiMapConfig(name); this.operationService = nodeEngine.getOperationService(); this.partitionService = nodeEngine.getPartitionService(); }
public AbstractTransactionalCollectionProxy(String name, Transaction tx, NodeEngine nodeEngine, S service) { super(nodeEngine, service, tx); this.name = name; this.partitionId = nodeEngine.getPartitionService().getPartitionId(getNameAsPartitionAwareData()); this.operationService = nodeEngine.getOperationService(); }
public PartitionScanRunner(MapServiceContext mapServiceContext) { this.mapServiceContext = mapServiceContext; this.nodeEngine = mapServiceContext.getNodeEngine(); this.serializationService = (InternalSerializationService) nodeEngine.getSerializationService(); this.partitionService = nodeEngine.getPartitionService(); this.logger = nodeEngine.getLogger(getClass()); this.operationService = nodeEngine.getOperationService(); this.clusterService = nodeEngine.getClusterService(); }
protected <T> T invoke(CollectionOperation operation) { final NodeEngine nodeEngine = getNodeEngine(); try { Future f = nodeEngine.getOperationService().invokeOnPartition(getServiceName(), operation, partitionId); return nodeEngine.toObject(f.get()); } catch (Throwable throwable) { throw ExceptionUtil.rethrow(throwable); } }
public void process(EntryTaskScheduler<Object, Object> scheduler, Collection<ScheduledEntry<Object, Object>> entries) { EvictionOperation evictionOperation = new EvictionOperation(store, entries); evictionOperation.setPartitionId(partitionId); nodeEngine.getOperationService().invokeOnTarget(SERVICE_NAME, evictionOperation, nodeEngine.getThisAddress()); } }
private ICompletableFuture<Object> invokeOnMember(Member member) { Address address = member.getAddress(); Operation operation = operationSupplier.get(); String serviceName = operation.getServiceName(); return nodeEngine.getOperationService().invokeOnTarget(serviceName, operation, address); }
private void invoke(boolean isRemove, Address address, String name, Data key, Data value, long ttl, VersionResponsePair response) { OperationService operationService = nodeEngine.getOperationService(); ReplicateUpdateOperation updateOperation = new ReplicateUpdateOperation(name, key, value, ttl, response, isRemove, nodeEngine.getThisAddress()); updateOperation.setPartitionId(partitionId); updateOperation.setValidateTarget(false); operationService.invokeOnTarget(SERVICE_NAME, updateOperation, address); }
@Override protected <K, V> CacheConfig<K, V> getCacheConfig(String cacheNameWithPrefix, String cacheName) { CacheGetConfigOperation op = new CacheGetConfigOperation(cacheNameWithPrefix, cacheName); int partitionId = nodeEngine.getPartitionService().getPartitionId(cacheNameWithPrefix); InternalCompletableFuture<CacheConfig<K, V>> f = nodeEngine.getOperationService() .invokeOnPartition(CacheService.SERVICE_NAME, op, partitionId); return f.join(); }
private void requestDataFromOwner(String name) { OperationService operationService = getNodeEngine().getOperationService(); Operation op = new RequestMapDataOperation(name); operationService .createInvocationBuilder(SERVICE_NAME, op, getPartitionId()) .setTryCount(INVOCATION_TRY_COUNT) .invoke(); }
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(); }
/** Send a response to the replica to retry the replica sync */ private void sendRetryResponse() { NodeEngine nodeEngine = getNodeEngine(); int partitionId = getPartitionId(); int replicaIndex = getReplicaIndex(); PartitionReplicaSyncRetryResponse response = new PartitionReplicaSyncRetryResponse(namespaces); response.setPartitionId(partitionId).setReplicaIndex(replicaIndex); Address target = getCallerAddress(); OperationService operationService = nodeEngine.getOperationService(); operationService.send(response, target); }
private void submit(UnlockOperation operation, Data key) { int partitionId = nodeEngine.getPartitionService().getPartitionId(key); OperationService operationService = nodeEngine.getOperationService(); operation.setPartitionId(partitionId); operation.setOperationResponseHandler(unlockResponseHandler); operation.setValidateTarget(false); operation.setAsyncBackup(true); operationService.invokeOnTarget(SERVICE_NAME, operation, nodeEngine.getThisAddress()); }
private void updateCacheListenerConfigOnOtherNodes(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, boolean isRegister) { OperationService operationService = getNodeEngine().getOperationService(); Collection<Member> members = getNodeEngine().getClusterService().getMembers(); for (Member member : members) { if (!member.localMember()) { Operation op = new CacheListenerRegistrationOperation(getDistributedObjectName(), cacheEntryListenerConfiguration, isRegister); operationService.invokeOnTarget(CacheService.SERVICE_NAME, op, member.getAddress()); } } }
private void updateCacheListenerConfigOnOtherNodes(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, boolean isRegister) { OperationService operationService = getNodeEngine().getOperationService(); Collection<Member> members = getNodeEngine().getClusterService().getMembers(); for (Member member : members) { if (!member.localMember()) { Operation op = new CacheListenerRegistrationOperation(getDistributedObjectName(), cacheEntryListenerConfiguration, isRegister); operationService.invokeOnTarget(CacheService.SERVICE_NAME, op, member.getAddress()); } } }
private void clearRemoteTransactions(Xid xid) { NodeEngine nodeEngine = getNodeEngine(); IPartitionService partitionService = nodeEngine.getPartitionService(); OperationService operationService = nodeEngine.getOperationService(); SerializableXID serializableXID = new SerializableXID(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier()); Data xidData = nodeEngine.toData(serializableXID); int partitionId = partitionService.getPartitionId(xidData); ClearRemoteTransactionOperation operation = new ClearRemoteTransactionOperation(xidData); operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId); }
protected void sendUpdateCallerOperation(boolean isRemove) { OperationService operationService = getNodeEngine().getOperationService(); Operation op = new ReplicateUpdateToCallerOperation(name, getCallId(), key, value, response, ttl, isRemove) .setPartitionId(getPartitionId()) .setValidateTarget(false) .setServiceName(getServiceName()); operationService .createInvocationBuilder(getServiceName(), op, getCallerAddress()) .setTryCount(INVOCATION_TRY_COUNT) .invoke(); }