Search in sources :

Example 41 with OperationServiceImpl

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

the class FrozenPartitionTableTest method partitionTable_shouldBeFixed_whenMemberRestarts_usingUuidOfAnotherMissingMember.

@Test
public void partitionTable_shouldBeFixed_whenMemberRestarts_usingUuidOfAnotherMissingMember() {
    ruleStaleJoinPreventionDuration.setOrClearProperty("5");
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
    HazelcastInstance hz1 = factory.newHazelcastInstance();
    HazelcastInstance hz2 = factory.newHazelcastInstance();
    HazelcastInstance hz3 = factory.newHazelcastInstance();
    HazelcastInstance hz4 = factory.newHazelcastInstance();
    assertClusterSizeEventually(4, hz2, hz3);
    warmUpPartitions(hz1, hz2, hz3, hz4);
    changeClusterStateEventually(hz4, ClusterState.FROZEN);
    int member3PartitionId = getPartitionId(hz3);
    int member4PartitionId = getPartitionId(hz4);
    MemberImpl member3 = getNode(hz3).getLocalMember();
    MemberImpl member4 = getNode(hz4).getLocalMember();
    hz3.shutdown();
    hz4.shutdown();
    assertClusterSizeEventually(2, hz1, hz2);
    newHazelcastInstance(initOrCreateConfig(new Config()), randomName(), new StaticMemberNodeContext(factory, member4.getUuid(), member3.getAddress()));
    assertClusterSizeEventually(3, hz1, hz2);
    waitAllForSafeState(hz1, hz2);
    OperationServiceImpl operationService = getOperationService(hz1);
    operationService.invokeOnPartition(null, new NonRetryablePartitionOperation(), member3PartitionId).join();
    try {
        operationService.invokeOnPartition(null, new NonRetryablePartitionOperation(), member4PartitionId).joinInternal();
        fail("Invocation to missing member should have failed!");
    } catch (TargetNotMemberException ignored) {
    }
}
Also used : TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) HazelcastInstance(com.hazelcast.core.HazelcastInstance) HazelcastInstanceFactory.newHazelcastInstance(com.hazelcast.instance.impl.HazelcastInstanceFactory.newHazelcastInstance) StaticMemberNodeContext(com.hazelcast.instance.StaticMemberNodeContext) MemberImpl(com.hazelcast.cluster.impl.MemberImpl) Config(com.hazelcast.config.Config) TestHazelcastInstanceFactory.initOrCreateConfig(com.hazelcast.test.TestHazelcastInstanceFactory.initOrCreateConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 42 with OperationServiceImpl

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

the class AtomicLongBackupTest method readAtomicLongValue.

private long readAtomicLongValue(final HazelcastInstance instance) {
    final OperationServiceImpl operationService = (OperationServiceImpl) getOperationService(instance);
    final AtomicLongService atomicLongService = getNodeEngineImpl(instance).getService(AtomicLongService.SERVICE_NAME);
    final GetLongValue task = new GetLongValue(atomicLongService);
    operationService.execute(task);
    assertOpenEventually(task.latch);
    return task.value;
}
Also used : OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Example 43 with OperationServiceImpl

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

the class CreateProxyMessageTask method getInvocationBuilder.

@Override
protected InvocationBuilder getInvocationBuilder(Operation op) {
    final OperationServiceImpl operationService = nodeEngine.getOperationService();
    if (!nodeEngine.getLocalMember().isLiteMember()) {
        // if this is a data member run the create proxy here
        return operationService.createInvocationBuilder(getServiceName(), op, nodeEngine.getThisAddress());
    }
    // otherwise find a data member to send the operation
    Collection<Member> members = nodeEngine.getClusterService().getMembers(MemberSelectors.DATA_MEMBER_SELECTOR);
    Iterator<Member> iterator = members.iterator();
    if (iterator.hasNext()) {
        Member member = iterator.next();
        Address address = member.getAddress();
        return operationService.createInvocationBuilder(getServiceName(), op, address);
    }
    // if no data member found run on this member. CreateProxy operation itself will send exception if not able to create.
    return operationService.createInvocationBuilder(getServiceName(), op, nodeEngine.getThisAddress());
}
Also used : Address(com.hazelcast.cluster.Address) Member(com.hazelcast.cluster.Member) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Example 44 with OperationServiceImpl

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

the class AbstractAllPartitionsMessageTask method processInternal.

@Override
protected CompletableFuture<Map<Integer, Object>> processInternal() {
    OperationFactory operationFactory = new OperationFactoryWrapper(createOperationFactory(), endpoint.getUuid());
    OperationServiceImpl operationService = nodeEngine.getOperationService();
    return operationService.invokeOnAllPartitionsAsync(getServiceName(), operationFactory);
}
Also used : OperationFactoryWrapper(com.hazelcast.client.impl.operations.OperationFactoryWrapper) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl) OperationFactory(com.hazelcast.spi.impl.operationservice.OperationFactory)

Example 45 with OperationServiceImpl

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

the class ReplicateUpdateToCallerOperation method notifyCaller.

private void notifyCaller() {
    OperationServiceImpl operationService = (OperationServiceImpl) getNodeEngine().getOperationService();
    operationService.getBackupHandler().notifyBackupComplete(callId);
}
Also used : OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Aggregations

OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)70 Test (org.junit.Test)29 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)26 QuickTest (com.hazelcast.test.annotation.QuickTest)25 Address (com.hazelcast.cluster.Address)22 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)16 HazelcastInstance (com.hazelcast.core.HazelcastInstance)15 Operation (com.hazelcast.spi.impl.operationservice.Operation)12 PartitionIdSet (com.hazelcast.internal.util.collection.PartitionIdSet)11 IndexIterationPointer (com.hazelcast.internal.iteration.IndexIterationPointer)10 MapFetchIndexOperationResult (com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult)10 Config (com.hazelcast.config.Config)9 ExecutionException (java.util.concurrent.ExecutionException)9 Accessors.getNodeEngineImpl (com.hazelcast.test.Accessors.getNodeEngineImpl)8 AssertTask (com.hazelcast.test.AssertTask)7 CountDownLatch (java.util.concurrent.CountDownLatch)7 Member (com.hazelcast.cluster.Member)5 Data (com.hazelcast.internal.serialization.Data)5 MapService (com.hazelcast.map.impl.MapService)5 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)5