Search in sources :

Example 66 with MapServiceContext

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

the class IndexIntegrationTest method getIndexOfAttributeForMap.

private static List<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);
    List<Index> result = new ArrayList<>();
    for (int partitionId : mapServiceContext.getOrInitCachedMemberPartitions()) {
        Indexes indexes = mapContainer.getIndexes(partitionId);
        for (InternalIndex index : indexes.getIndexes()) {
            for (String component : index.getComponents()) {
                if (component.equals(IndexUtils.canonicalizeAttribute(attribute))) {
                    result.add(index);
                    break;
                }
            }
        }
    }
    return result;
}
Also used : Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) ArrayList(java.util.ArrayList) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 67 with MapServiceContext

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

the class StaleReadDetectorTest method isRepairingHandlerCreatedForMap.

private static boolean isRepairingHandlerCreatedForMap(HazelcastInstance node, String mapName) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(node);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    ConcurrentMap<String, RepairingHandler> handlers = mapNearCacheManager.getRepairingTask().getHandlers();
    RepairingHandler repairingHandler = handlers.get(mapName);
    return repairingHandler != null;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 68 with MapServiceContext

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

the class ClientMapInvalidationMetaDataFetcherTest method distortRandomPartitionSequence.

private void distortRandomPartitionSequence(String mapName, int partition, long sequence, 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();
    metaDataGenerator.setCurrentSequence(mapName, partition, sequence);
}
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 69 with MapServiceContext

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

the class ClientMapStoreTest method getMapStoreInstance.

// given a member-side HazelcastInstance and a mapName, return the MapStore instance
// or null if none configured
private <T extends MapStore> T getMapStoreInstance(HazelcastInstance hz, String mapName) {
    MapProxyImpl map = (MapProxyImpl) hz.getMap(mapName);
    MapService service = (MapService) map.getService();
    MapServiceContext context = service.getMapServiceContext();
    MapContainer container = context.getMapContainer(mapName);
    return (T) container.getMapStoreContext().getMapStoreWrapper().getMapStore();
}
Also used : MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 70 with MapServiceContext

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

the class MapAddListenerMessageTask method registerListener.

private String registerListener(ClientEndpoint endpoint, ListenerAdapter adapter) {
    MapService mapService = getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    String registrationId;
    if (parameters.localOnly) {
        registrationId = mapServiceContext.addLocalListenerAdapter(adapter, parameters.listenerName);
    } else {
        registrationId = mapServiceContext.addListenerAdapter(adapter, TrueEventFilter.INSTANCE, parameters.listenerName);
    }
    endpoint.addListenerDestroyAction(MapService.SERVICE_NAME, parameters.listenerName, registrationId);
    return registrationId;
}
Also used : MapService(com.hazelcast.map.impl.MapService) 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