Search in sources :

Example 51 with MapServiceContext

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

the class WriteBehindEntryStoreQueueReplicationTest method dumpNotExpiredRecordsToString.

private static String dumpNotExpiredRecordsToString(HazelcastInstance node, String mapName) {
    List<Long> msg = new ArrayList<>();
    NodeEngineImpl nodeEngine = getNode(node).getNodeEngine();
    MapService mapService = nodeEngine.getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
    for (int i = 0; i < partitionCount; i++) {
        RecordStore<Record> recordStore = mapServiceContext.getExistingRecordStore(i, mapName);
        if (recordStore == null) {
            continue;
        }
        recordStore.forEach((data, record) -> msg.add(recordStore.getExpirySystem().getExpiryMetadata(data).getTtl()), false);
    }
    return msg.toString();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ArrayList(java.util.ArrayList) Record(com.hazelcast.map.impl.record.Record) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 52 with MapServiceContext

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

the class NearCacheTestSupport method getNearCache.

protected NearCache getNearCache(String mapName, HazelcastInstance instance) {
    NodeEngineImpl nodeEngine = getNode(instance).nodeEngine;
    MapService service = nodeEngine.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = service.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    NearCacheConfig nearCacheConfig = nodeEngine.getConfig().getMapConfig(mapName).getNearCacheConfig();
    return mapNearCacheManager.getOrCreateNearCache(mapName, nearCacheConfig);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 53 with MapServiceContext

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

the class WriteBehindFailAndRetryTest method sizeOfWriteBehindQueueInPartition.

private static int sizeOfWriteBehindQueueInPartition(int partitionId, IMap map) {
    MapService mapService = (MapService) ((MapProxyImpl) map).getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    PartitionContainer container = mapServiceContext.getPartitionContainer(partitionId);
    RecordStore recordStore = container.getRecordStore(map.getName());
    return ((WriteBehindStore) recordStore.getMapDataStore()).getWriteBehindQueue().size();
}
Also used : PartitionContainer(com.hazelcast.map.impl.PartitionContainer) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 54 with MapServiceContext

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

the class MemberMapInvalidationMetadataDistortionTest method distortRandomPartitionUuid.

private void distortRandomPartitionUuid(HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    int partitionCount = nodeEngineImpl.getPartitionService().getPartitionCount();
    int partitionId = getInt(partitionCount);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    metaDataGenerator.setUuid(partitionId, UuidUtil.newUnsecureUUID());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 55 with MapServiceContext

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

the class MemberMapInvalidationMetadataDistortionTest method distortRandomPartitionSequence.

private void distortRandomPartitionSequence(String mapName, HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
    int partitionCount = partitionService.getPartitionCount();
    metaDataGenerator.setCurrentSequence(mapName, getInt(partitionCount), getInt(MAX_VALUE));
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Aggregations

MapServiceContext (com.hazelcast.map.impl.MapServiceContext)137 MapService (com.hazelcast.map.impl.MapService)111 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)34 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)29 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)25 MapContainer (com.hazelcast.map.impl.MapContainer)22 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)22 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)20 Accessors.getNodeEngineImpl (com.hazelcast.test.Accessors.getNodeEngineImpl)16 HazelcastInstance (com.hazelcast.core.HazelcastInstance)15 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)15 NodeEngine (com.hazelcast.spi.impl.NodeEngine)14 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)13 Node (com.hazelcast.instance.impl.Node)12 Data (com.hazelcast.internal.serialization.Data)11 Accessors.getNode (com.hazelcast.test.Accessors.getNode)10 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)9 Config (com.hazelcast.config.Config)8 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)8