@Override public void run() { Operation op = new TriggerLoadIfNeededOperation(mapName); opService.invokeOnPartition(SERVICE_NAME, op, mapNamePartition); } };
@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()); } });
@Override public ICompletableFuture<EventJournalInitialSubscriberState> subscribeToEventJournal(int partitionId) { final MapEventJournalSubscribeOperation op = new MapEventJournalSubscribeOperation(name); op.setPartitionId(partitionId); return operationService.invokeOnPartition(op); }
@Override public Future invokeOnPartitionOwner(Object operation, int partitionId) { checkNotNull(operation, "operation cannot be null"); checkNotNegative(partitionId, "partitionId"); Operation op = (Operation) operation; return operationService.invokeOnPartition(MapService.SERVICE_NAME, op, partitionId); }
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); } }
private InternalCompletableFuture invoke(Operation operation) { final NodeEngine nodeEngine = getNodeEngine(); OperationService operationService = nodeEngine.getOperationService(); return operationService.invokeOnPartition(QueueService.SERVICE_NAME, operation, getPartitionId()); }
private ResultSegment invoke(Operation operation) { final InternalCompletableFuture<ResultSegment> future = mapProxy.getOperationService().invokeOnPartition(mapProxy.getServiceName(), operation, partitionId); return future.join(); }
protected Future<Result> dispatchPartitionScanQueryOnOwnerMemberOnPartitionThread(Query query, int partitionId) { Operation op = createQueryPartitionOperation(query); op.setPartitionId(partitionId); try { return operationService.invokeOnPartition(MapService.SERVICE_NAME, op, partitionId); } catch (Throwable t) { throw rethrow(t); } }
/** * 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); }
private InternalCompletableFuture invoke(Operation operation) { final NodeEngine nodeEngine = getNodeEngine(); OperationService operationService = nodeEngine.getOperationService(); return operationService.invokeOnPartition(QueueService.SERVICE_NAME, operation, getPartitionId()); }
/** * Invokes an operation to put the provided key-value pairs to the partition * record store. * * @param keyValueSequence the list of serialised alternating key-value pairs * @return the future representing the pending completion of the put operation */ private Future<?> sendOperation(List<Data> keyValueSequence) { OperationService operationService = mapServiceContext.getNodeEngine().getOperationService(); Operation operation = createOperation(keyValueSequence); return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId); }
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); } }
@Override public ICompletableFuture<EventJournalInitialSubscriberState> subscribeToEventJournal(int partitionId) { final CacheEventJournalSubscribeOperation op = new CacheEventJournalSubscribeOperation(nameWithPrefix); op.setPartitionId(partitionId); return getNodeEngine().getOperationService().invokeOnPartition(op); }
protected EntryView getEntryViewInternal(Data key) { int partitionId = partitionService.getPartitionId(key); MapOperation operation = operationProvider.createGetEntryViewOperation(name, key); operation.setThreadId(getThreadId()); operation.setServiceName(SERVICE_NAME); try { Future future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId); return (EntryView) toObject(future.get()); } catch (Throwable t) { throw rethrow(t); } }
@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 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 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()); }
@Override public V remove(Object key) { isNotNull(key, "key"); Data dataKey = nodeEngine.toData(key); int partitionId = partitionService.getPartitionId(key); RemoveOperation removeOperation = new RemoveOperation(getName(), dataKey); InternalCompletableFuture<Object> future = getOperationService() .invokeOnPartition(getServiceName(), removeOperation, partitionId); VersionResponsePair result = (VersionResponsePair) future.join(); return nodeEngine.toObject(result.getResponse()); }
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); }
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); }