Search in sources :

Example 11 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapQueryEngineImplTest method before.

@Before
public void before() {
    instance = createHazelcastInstance();
    map = instance.getMap(randomName());
    MapService mapService = getNodeEngineImpl(instance).getService(MapService.SERVICE_NAME);
    queryEngine = mapService.getMapServiceContext().getMapQueryEngine(map.getName());
    partitionId = 100;
    key = generateKeyForPartition(instance, partitionId);
    value = randomString();
    map.put(key, value);
}
Also used : MapService(com.hazelcast.map.impl.MapService) Before(org.junit.Before)

Example 12 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapQueryEngineImpl_queryLocalPartitions_resultSizeLimitTest method setup.

@Before
public void setup() {
    Config config = new Config();
    config.setProperty(GroupProperty.PARTITION_COUNT.getName(), "" + PARTITION_COUNT);
    config.setProperty(GroupProperty.QUERY_RESULT_SIZE_LIMIT.getName(), "" + RESULT_SIZE_LIMIT);
    HazelcastInstance hz = createHazelcastInstance(config);
    map = hz.getMap(randomName());
    MapService mapService = getNodeEngineImpl(hz).getService(MapService.SERVICE_NAME);
    queryEngine = new MapQueryEngineImpl(mapService.getMapServiceContext());
    // we fill all partitions, so we get the NodeResultLimit for all partitions as well
    QueryResultSizeLimiter resultSizeLimiter = queryEngine.getQueryResultSizeLimiter();
    limit = (int) resultSizeLimiter.getNodeResultLimit(PARTITION_COUNT);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) MapService(com.hazelcast.map.impl.MapService) Before(org.junit.Before)

Example 13 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapStoreWriteBehindTest method writeBehindQueueSize.

private int writeBehindQueueSize(HazelcastInstance node, String mapName) {
    int size = 0;
    final NodeEngineImpl nodeEngine = getNode(node).getNodeEngine();
    MapService mapService = nodeEngine.getService(MapService.SERVICE_NAME);
    final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    final int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
    for (int i = 0; i < partitionCount; i++) {
        final RecordStore recordStore = mapServiceContext.getExistingRecordStore(i, mapName);
        if (recordStore == null) {
            continue;
        }
        final MapDataStore mapDataStore = recordStore.getMapDataStore();
        size += ((WriteBehindStore) mapDataStore).getWriteBehindQueue().size();
    }
    return size;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) WriteBehindStore(com.hazelcast.map.impl.mapstore.writebehind.WriteBehindStore)

Example 14 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class IndexIntegrationTest method getIndexOfAttributeForMap.

private static Index getIndexOfAttributeForMap(HazelcastInstance instance, String mapName, String attribute) {
    Node node = getNode(instance);
    MapService service = node.nodeEngine.getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = service.getMapServiceContext();
    MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
    Indexes indexes = mapContainer.getIndexes();
    return indexes.getIndex(attribute);
}
Also used : Node(com.hazelcast.instance.Node) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 15 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapNearCacheStateHolder method applyState.

void applyState() {
    MapService mapService = mapReplicationOperation.getService();
    MetaDataGenerator metaDataGenerator = getPartitionMetaDataGenerator(mapService);
    int partitionId = mapReplicationOperation.getPartitionId();
    if (partitionUuid != null) {
        metaDataGenerator.setUuid(partitionId, partitionUuid);
    }
    for (int i = 0; i < mapNameSequencePairs.size(); ) {
        String mapName = (String) mapNameSequencePairs.get(i++);
        long sequence = (Long) mapNameSequencePairs.get(i++);
        metaDataGenerator.setCurrentSequence(mapName, partitionId, sequence);
    }
}
Also used : MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)

Aggregations

MapService (com.hazelcast.map.impl.MapService)80 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)44 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)20 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)13 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)12 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)11 MapContainer (com.hazelcast.map.impl.MapContainer)10 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)10 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)8 Config (com.hazelcast.config.Config)7 Before (org.junit.Before)7 Data (com.hazelcast.nio.serialization.Data)6 Map (java.util.Map)6 Address (com.hazelcast.nio.Address)5 IPartitionLostEvent (com.hazelcast.spi.partition.IPartitionLostEvent)5 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)4