/** * De-serialize the operation fields to receive from remote to local. */ @Override protected void readInternal(ObjectDataInput objectDataInput) throws IOException { super.readInternal(objectDataInput); this.name = objectDataInput.readUTF(); } }
/** * Serialize the operation fields to send from local to remote. */ @Override protected void writeInternal(ObjectDataOutput objectDataOutput) throws IOException { super.writeInternal(objectDataOutput); objectDataOutput.writeUTF(this.name); }
public static void before(List<Operation> operationList, Operation wrapper) throws Exception { for (Operation operation : operationList) { operation.setService(wrapper.getService()); operation.setServiceName(wrapper.getServiceName()); operation.setCallerUuid(wrapper.getCallerUuid()); operation.setNodeEngine(wrapper.getNodeEngine()); operation.setPartitionId(wrapper.getPartitionId()); operation.beforeRun(); } }
@Override public void run() throws Exception { for (Operation op : opList) { op.setNodeEngine(getNodeEngine()).setServiceName(getServiceName()).setPartitionId(getPartitionId()); op.beforeRun(); op.run(); op.afterRun(); } // changed to forceUnlock because replica-sync of lock causes problems, same as IMap // real solution is to make 'lock-and-get' backup-aware getOrCreateContainerWithoutAccess().forceUnlock(dataKey); }
@Override protected Operation newPrimaryExpiryOp(int expirationPercentage, PartitionContainer container) { int partitionId = container.getPartitionId(); return new ClearExpiredOperation(expirationPercentage) .setNodeEngine(nodeEngine) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setPartitionId(partitionId) .setValidateTarget(false) .setServiceName(SERVICE_NAME); }
@Override @SuppressWarnings("unchecked") public <E> InternalCompletableFuture<E> invokeOnPartition(String serviceName, Operation op, int partitionId) { op.setServiceName(serviceName) .setPartitionId(partitionId) .setReplicaIndex(DEFAULT_REPLICA_INDEX); return new PartitionInvocation( invocationContext, op, invocationMaxRetryCount, invocationRetryPauseMillis, DEFAULT_CALL_TIMEOUT, DEFAULT_DESERIALIZE_RESULT, failOnIndeterminateOperationState).invoke(); }
private Operation createConsumerOperation(int partitionId, Queue<Accumulator> accumulators) { PublisherContext publisherContext = context.getPublisherContext(); NodeEngineImpl nodeEngine = (NodeEngineImpl) publisherContext.getNodeEngine(); Operation operation = new AccumulatorConsumerOperation(accumulators, MAX_PROCESSABLE_ACCUMULATOR_COUNT); operation .setNodeEngine(nodeEngine) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setPartitionId(partitionId) .setValidateTarget(false) .setService(nodeEngine.getService(MapService.SERVICE_NAME)); return operation; }
protected void prepareOperation(Operation op) { op.setNodeEngine(getNodeEngine()) .setPartitionId(getPartitionId()) .setReplicaIndex(getReplicaIndex()); op.setOperationResponseHandler(ERROR_RESPONSE_HANDLER); OperationAccessor.setCallerAddress(op, migrationInfo.getSource()); }
// Implementing a fromString method on an enum type private static final Map<String, Operation> stringToEnum = new HashMap<String, Operation>(); static { // Initialize map from constant name to enum constant for (Operation op : values()) stringToEnum.put(op.toString(), op); } // Returns Operation for string, or null if string is invalid public static Operation fromString(String symbol) { return stringToEnum.get(symbol); }
private boolean isQuorumAware(Operation op) { return op.getService() instanceof QuorumAwareService; }
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(); }
@Override public Operation newCommitOperation() { MapTxnOperation operation = (MapTxnOperation) op; operation.setThreadId(threadId); operation.setOwnerUuid(ownerUuid); op.setPartitionId(partitionId); return op; }
private boolean perform(Operation operation) { if(station.getState == Station.Closed) return false; operation.run(); return true; }
@Override @SuppressWarnings("unchecked") public <E> InternalCompletableFuture<E> invokeOnTarget(String serviceName, Operation op, Address target) { op.setServiceName(serviceName); return new TargetInvocation(invocationContext, op, target, invocationMaxRetryCount, invocationRetryPauseMillis, DEFAULT_CALL_TIMEOUT, DEFAULT_DESERIALIZE_RESULT).invoke(); }
@Override public void run() throws Exception { for (Operation op : opList) { op.setNodeEngine(getNodeEngine()).setServiceName(getServiceName()).setPartitionId(getPartitionId()); op.beforeRun(); op.run(); op.afterRun(); } // changed to forceUnlock because replica-sync of lock causes problems, same as IMap // real solution is to make 'lock-and-get' backup-aware getOrCreateContainerWithoutAccess().forceUnlock(dataKey); }
@Override protected Operation newPrimaryExpiryOp(int expirationPercentage, CachePartitionSegment container) { return new CacheClearExpiredOperation(expirationPercentage) .setNodeEngine(nodeEngine) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setPartitionId(container.getPartitionId()) .setValidateTarget(false) .setServiceName(SERVICE_NAME); }
@Override @SuppressWarnings("unchecked") public <E> InternalCompletableFuture<E> invokeOnPartition(String serviceName, Operation op, int partitionId) { op.setServiceName(serviceName) .setPartitionId(partitionId) .setReplicaIndex(DEFAULT_REPLICA_INDEX); return new PartitionInvocation( invocationContext, op, invocationMaxRetryCount, invocationRetryPauseMillis, DEFAULT_CALL_TIMEOUT, DEFAULT_DESERIALIZE_RESULT, failOnIndeterminateOperationState).invoke(); }