Search in sources :

Example 1 with CancellationOperation

use of com.hazelcast.executor.impl.operations.CancellationOperation in project hazelcast by hazelcast.

the class ExecutorServiceCancelOnPartitionMessageTask method createInvocationBuilder.

@Override
protected InvocationBuilder createInvocationBuilder() throws UnknownHostException {
    final InternalOperationService operationService = nodeEngine.getOperationService();
    final String serviceName = DistributedExecutorService.SERVICE_NAME;
    CancellationOperation op = new CancellationOperation(parameters.uuid, parameters.interrupt);
    return operationService.createInvocationBuilder(serviceName, op, parameters.partitionId);
}
Also used : CancellationOperation(com.hazelcast.executor.impl.operations.CancellationOperation) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 2 with CancellationOperation

use of com.hazelcast.executor.impl.operations.CancellationOperation in project hazelcast by hazelcast.

the class SerializationServiceV1Test method test_callid_on_correct_stream_position.

@Test
public void test_callid_on_correct_stream_position() throws Exception {
    CancellationOperation operation = new CancellationOperation(UuidUtil.newUnsecureUUID(), true);
    operation.setCallerUuid(UuidUtil.newUnsecureUUID());
    OperationAccessor.setCallId(operation, 12345);
    Data data = serializationService.toData(operation);
    long callId = serializationService.initDataSerializableInputAndSkipTheHeader(data).readLong();
    assertEquals(12345, callId);
}
Also used : CancellationOperation(com.hazelcast.executor.impl.operations.CancellationOperation) Data(com.hazelcast.internal.serialization.Data) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with CancellationOperation

use of com.hazelcast.executor.impl.operations.CancellationOperation in project hazelcast by hazelcast.

the class ExecutorServiceCancelOnAddressMessageTask method createInvocationBuilder.

@Override
protected InvocationBuilder createInvocationBuilder() throws UnknownHostException {
    final InternalOperationService operationService = nodeEngine.getOperationService();
    final String serviceName = DistributedExecutorService.SERVICE_NAME;
    CancellationOperation op = new CancellationOperation(parameters.uuid, parameters.interrupt);
    return operationService.createInvocationBuilder(serviceName, op, parameters.address);
}
Also used : CancellationOperation(com.hazelcast.executor.impl.operations.CancellationOperation) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 4 with CancellationOperation

use of com.hazelcast.executor.impl.operations.CancellationOperation in project hazelcast by hazelcast.

the class CancellableDelegatingFuture method invokeCancelOperation.

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();
}
Also used : CancellationOperation(com.hazelcast.executor.impl.operations.CancellationOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) InvocationBuilder(com.hazelcast.spi.impl.operationservice.InvocationBuilder)

Aggregations

CancellationOperation (com.hazelcast.executor.impl.operations.CancellationOperation)4 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)2 Data (com.hazelcast.internal.serialization.Data)1 InvocationBuilder (com.hazelcast.spi.impl.operationservice.InvocationBuilder)1 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1