Search in sources :

Example 56 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class BasicRecordStoreLoader method sendOperation.

/**
 * Invokes an operation to put the provided key-value pairs to the partition
 * record store.
 *
 * @param loadingSequence the list of serialised key-value-(expirationTime)
 *                        sequences
 * @return the future representing the pending completion of the put operation
 */
private Future<?> sendOperation(List<Data> loadingSequence) {
    OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    Operation operation = createOperation(loadingSequence);
    operation.setNodeEngine(nodeEngine);
    operation.setPartitionId(partitionId);
    OperationAccessor.setCallerAddress(operation, nodeEngine.getThisAddress());
    operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
    operation.setServiceName(MapService.SERVICE_NAME);
    return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) Operation(com.hazelcast.spi.impl.operationservice.Operation) RemoveFromLoadAllOperation(com.hazelcast.map.impl.operation.RemoveFromLoadAllOperation)

Example 57 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class PublisherCreateOperation method readAndResetAccumulator.

/**
 * 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);
}
Also used : Operation(com.hazelcast.spi.impl.operationservice.Operation) AbstractNamedOperation(com.hazelcast.spi.impl.operationservice.AbstractNamedOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 58 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class NodeQueryCacheEndToEndConstructor method madePublishable.

private void madePublishable(String mapName, String cacheId) {
    InvokerWrapper invokerWrapper = context.getInvokerWrapper();
    Collection<Member> memberList = context.getMemberList();
    List<Future> futures = new ArrayList<>(memberList.size());
    for (Member member : memberList) {
        Operation operation = new MadePublishableOperation(mapName, cacheId);
        Future future = invokerWrapper.invokeOnTarget(operation, member);
        futures.add(future);
    }
    waitWithDeadline(futures, OPERATION_WAIT_TIMEOUT_MINUTES, MINUTES);
}
Also used : MadePublishableOperation(com.hazelcast.map.impl.querycache.subscriber.operation.MadePublishableOperation) InvokerWrapper(com.hazelcast.map.impl.querycache.InvokerWrapper) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) PublisherCreateOperation(com.hazelcast.map.impl.querycache.subscriber.operation.PublisherCreateOperation) MadePublishableOperation(com.hazelcast.map.impl.querycache.subscriber.operation.MadePublishableOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) Member(com.hazelcast.cluster.Member)

Example 59 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class TxnCommitOperation method run.

@Override
public void run() throws Exception {
    for (Operation op : opList) {
        op.setNodeEngine(getNodeEngine()).setServiceName(getServiceName()).setPartitionId(getPartitionId());
        runDirect(op);
    }
    getOrCreateContainer().unlock(dataKey, getCallerUuid(), threadId, getCallId());
}
Also used : BackupAwareOperation(com.hazelcast.spi.impl.operationservice.BackupAwareOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) AbstractBackupAwareMultiMapOperation(com.hazelcast.multimap.impl.operations.AbstractBackupAwareMultiMapOperation)

Example 60 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class MultiMapTransactionLogRecord method writeData.

@Override
public void writeData(ObjectDataOutput out) throws IOException {
    out.writeString(name);
    out.writeInt(partitionId);
    out.writeInt(opList.size());
    for (Operation op : opList) {
        out.writeObject(op);
    }
    IOUtil.writeData(out, key);
    out.writeLong(ttl);
    out.writeLong(threadId);
}
Also used : Operation(com.hazelcast.spi.impl.operationservice.Operation)

Aggregations

Operation (com.hazelcast.spi.impl.operationservice.Operation)271 Test (org.junit.Test)80 QuickTest (com.hazelcast.test.annotation.QuickTest)79 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)59 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)56 Address (com.hazelcast.cluster.Address)31 HazelcastInstance (com.hazelcast.core.HazelcastInstance)25 Data (com.hazelcast.internal.serialization.Data)24 Future (java.util.concurrent.Future)24 Member (com.hazelcast.cluster.Member)22 ArrayList (java.util.ArrayList)21 NodeEngine (com.hazelcast.spi.impl.NodeEngine)18 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)17 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)17 AssertTask (com.hazelcast.test.AssertTask)15 ILogger (com.hazelcast.logging.ILogger)14 UrgentSystemOperation (com.hazelcast.spi.impl.operationservice.UrgentSystemOperation)13 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)13 Config (com.hazelcast.config.Config)12 CompletableFuture (java.util.concurrent.CompletableFuture)12