Search in sources :

Example 6 with Operation

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

the class CardinalityEstimatorProxy method addAsync.

@Override
public InternalCompletableFuture<Void> addAsync(Object obj) {
    checkNotNull(obj, "Object is null.");
    Data data = getNodeEngine().getSerializationService().toData(obj);
    Operation operation = new AggregateOperation(name, data.hash64()).setPartitionId(partitionId);
    return invokeOnPartition(operation);
}
Also used : Data(com.hazelcast.nio.serialization.Data) Operation(com.hazelcast.spi.Operation) AggregateOperation(com.hazelcast.cardinality.impl.operations.AggregateOperation) EstimateOperation(com.hazelcast.cardinality.impl.operations.EstimateOperation) AggregateOperation(com.hazelcast.cardinality.impl.operations.AggregateOperation)

Example 7 with Operation

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

the class AbstractMultiTargetMessageTask method processMessage.

@Override
protected void processMessage() throws Throwable {
    Supplier<Operation> operationSupplier = createOperationSupplier();
    Collection<Member> targets = getTargets();
    returnResponseIfNoTargetLeft(targets, EMPTY_MAP);
    final InternalOperationService operationService = nodeEngine.getOperationService();
    MultiTargetCallback callback = new MultiTargetCallback(targets);
    for (Member target : targets) {
        Operation op = operationSupplier.get();
        InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, target.getAddress()).setResultDeserialized(false).setExecutionCallback(new SingleTargetCallback(target, callback));
        builder.invoke();
    }
}
Also used : Operation(com.hazelcast.spi.Operation) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) InvocationBuilder(com.hazelcast.spi.InvocationBuilder) Member(com.hazelcast.core.Member)

Example 8 with Operation

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

the class AbstractInvocationMessageTask method processMessage.

@Override
protected void processMessage() {
    final ClientEndpoint endpoint = getEndpoint();
    Operation op = prepareOperation();
    op.setCallerUuid(endpoint.getUuid());
    InvocationBuilder builder = getInvocationBuilder(op).setExecutionCallback(this).setResultDeserialized(false);
    builder.invoke();
}
Also used : Operation(com.hazelcast.spi.Operation) InvocationBuilder(com.hazelcast.spi.InvocationBuilder) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Example 9 with Operation

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

the class XAClearRemoteTransactionMessageTask method call.

@Override
protected Object call() throws Exception {
    InternalOperationService operationService = nodeEngine.getOperationService();
    InternalPartitionService partitionService = nodeEngine.getPartitionService();
    ClientEndpoint endpoint = getEndpoint();
    Data xidData = serializationService.toData(parameters.xid);
    Operation op = new ClearRemoteTransactionOperation(xidData);
    op.setCallerUuid(endpoint.getUuid());
    int partitionId = partitionService.getPartitionId(xidData);
    InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, partitionId);
    builder.setTryCount(TRY_COUNT).setResultDeserialized(false);
    builder.invoke();
    return XATransactionClearRemoteCodec.encodeResponse();
}
Also used : ClearRemoteTransactionOperation(com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) Data(com.hazelcast.nio.serialization.Data) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ClearRemoteTransactionOperation(com.hazelcast.transaction.impl.xa.operations.ClearRemoteTransactionOperation) Operation(com.hazelcast.spi.Operation) InvocationBuilder(com.hazelcast.spi.InvocationBuilder) ClientEndpoint(com.hazelcast.client.ClientEndpoint) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Example 10 with Operation

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

the class ScheduledExecutorShutdownMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    Operation op = new ShutdownOperation(parameters.schedulerName);
    op.setCallerUuid(endpoint.getUuid());
    return op;
}
Also used : ShutdownOperation(com.hazelcast.scheduledexecutor.impl.operations.ShutdownOperation) Operation(com.hazelcast.spi.Operation) ShutdownOperation(com.hazelcast.scheduledexecutor.impl.operations.ShutdownOperation)

Aggregations

Operation (com.hazelcast.spi.Operation)216 QuickTest (com.hazelcast.test.annotation.QuickTest)60 Test (org.junit.Test)60 OperationService (com.hazelcast.spi.OperationService)39 ParallelTest (com.hazelcast.test.annotation.ParallelTest)39 Future (java.util.concurrent.Future)19 Member (com.hazelcast.core.Member)18 Address (com.hazelcast.nio.Address)18 Data (com.hazelcast.nio.serialization.Data)18 HazelcastInstance (com.hazelcast.core.HazelcastInstance)17 AssertTask (com.hazelcast.test.AssertTask)17 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)15 ArrayList (java.util.ArrayList)15 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)14 NodeEngine (com.hazelcast.spi.NodeEngine)14 BackupAwareOperation (com.hazelcast.spi.BackupAwareOperation)13 BlockingOperation (com.hazelcast.spi.BlockingOperation)13 MapOperation (com.hazelcast.map.impl.operation.MapOperation)12 AtomicReference (java.util.concurrent.atomic.AtomicReference)11 Config (com.hazelcast.config.Config)10