Search in sources :

Example 26 with OperationServiceImpl

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

the class MapFetchIndexOperationTest method testRangeComposite.

@Test
public void testRangeComposite() throws ExecutionException, InterruptedException {
    PartitionIdSet partitions = getLocalPartitions(instance);
    IndexIterationPointer[] pointers = new IndexIterationPointer[1];
    pointers[0] = IndexIterationPointer.create(new CompositeValue(new Comparable[] { 30, CompositeValue.NEGATIVE_INFINITY }), true, new CompositeValue(new Comparable[] { CompositeValue.POSITIVE_INFINITY, CompositeValue.POSITIVE_INFINITY }), true, false, null);
    MapOperationProvider operationProvider = getOperationProvider(map);
    MapOperation operation = operationProvider.createFetchIndexOperation(mapName, compositeOrderedIndexName, pointers, partitions, 10);
    Address address = instance.getCluster().getLocalMember().getAddress();
    OperationServiceImpl operationService = getOperationService(instance);
    MapFetchIndexOperationResult result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
    assertResultSorted(result, Arrays.asList(new Person("person2", 39, "Dep1"), new Person("person5", 43, "Dep2"), new Person("person1", 45, "Dep1"), new Person("person4", 45, "Dep2"), new Person("person9", 45, "Dep3"), new Person("person10", 45, "Dep4"), new Person("person11", 45, "Dep5"), new Person("person3", 60, "Dep1"), new Person("person8", 79, null)));
}
Also used : Address(com.hazelcast.cluster.Address) IndexIterationPointer(com.hazelcast.internal.iteration.IndexIterationPointer) PartitionIdSet(com.hazelcast.internal.util.collection.PartitionIdSet) MapFetchIndexOperationResult(com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult) CompositeValue(com.hazelcast.query.impl.CompositeValue) 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 27 with OperationServiceImpl

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

the class MapFetchIndexOperationTest method testOneSideRange.

@Test
public void testOneSideRange() throws ExecutionException, InterruptedException {
    PartitionIdSet partitions = getLocalPartitions(instance);
    IndexIterationPointer[] pointers = new IndexIterationPointer[1];
    pointers[0] = IndexIterationPointer.create(null, true, 60, false, true, null);
    MapOperationProvider operationProvider = getOperationProvider(map);
    MapOperation operation = operationProvider.createFetchIndexOperation(mapName, orderedIndexName, pointers, partitions, 10);
    Address address = instance.getCluster().getLocalMember().getAddress();
    OperationServiceImpl operationService = getOperationService(instance);
    MapFetchIndexOperationResult result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
    assertResultSorted(result, Arrays.asList(new Person("person11", 45, "Dep5"), new Person("person10", 45, "Dep4"), new Person("person9", 45, "Dep3"), new Person("person4", 45, "Dep2"), new Person("person1", 45, "Dep1"), new Person("person5", 43, "Dep2"), new Person("person2", 39, "Dep1")));
}
Also used : Address(com.hazelcast.cluster.Address) IndexIterationPointer(com.hazelcast.internal.iteration.IndexIterationPointer) PartitionIdSet(com.hazelcast.internal.util.collection.PartitionIdSet) MapFetchIndexOperationResult(com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult) 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 28 with OperationServiceImpl

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

the class SlowOperationDetectorAbstractTest method shutdownOperationService.

static void shutdownOperationService(HazelcastInstance instance) {
    if (instance == null) {
        return;
    }
    OperationServiceImpl operationService = (OperationServiceImpl) getOperationService(instance);
    operationService.shutdownInvocations();
    operationService.shutdownOperationExecutor();
}
Also used : OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Example 29 with OperationServiceImpl

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

the class SlowOperationDetectorAbstractTest method getSlowOperationLogs.

static Collection<SlowOperationLog> getSlowOperationLogs(HazelcastInstance instance) {
    OperationServiceImpl operationService = getOperationService(instance);
    SlowOperationDetector slowOperationDetector = getFieldFromObject(operationService, "slowOperationDetector");
    Map<Integer, SlowOperationLog> slowOperationLogs = getFieldFromObject(slowOperationDetector, "slowOperationLogs");
    return slowOperationLogs.values();
}
Also used : OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Example 30 with OperationServiceImpl

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

the class QueryCacheIMapEventHandlingTest method executeMergeOperation.

private void executeMergeOperation(HazelcastInstance member, String mapName, int key, int mergedValue) throws Exception {
    Node node = getNode(member);
    NodeEngineImpl nodeEngine = node.nodeEngine;
    OperationServiceImpl operationService = nodeEngine.getOperationService();
    SerializationService serializationService = getSerializationService(member);
    Data keyData = serializationService.toData(key);
    Data valueData = serializationService.toData(mergedValue);
    SplitBrainMergeTypes.MapMergeTypes mergingEntry = createMergingEntry(serializationService, keyData, valueData, Mockito.mock(Record.class), ExpiryMetadata.NULL);
    Operation mergeOperation = new MergeOperation(mapName, singletonList(mergingEntry), new PassThroughMergePolicy<>(), false);
    int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
    Future<Object> future = operationService.invokeOnPartition(SERVICE_NAME, mergeOperation, partitionId);
    future.get();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MergeOperation(com.hazelcast.map.impl.operation.MergeOperation) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) SerializationService(com.hazelcast.internal.serialization.SerializationService) Accessors.getSerializationService(com.hazelcast.test.Accessors.getSerializationService) Data(com.hazelcast.internal.serialization.Data) Operation(com.hazelcast.spi.impl.operationservice.Operation) MergeOperation(com.hazelcast.map.impl.operation.MergeOperation) Record(com.hazelcast.map.impl.record.Record) SplitBrainMergeTypes(com.hazelcast.spi.merge.SplitBrainMergeTypes) 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