Search in sources :

Example 1 with MapService

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

the class ClientMapMetaDataFetcherTest 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) 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 2 with MapService

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

the class AbstractMapPartitionMessageTask method getMapOperationProvider.

protected final MapOperationProvider getMapOperationProvider(String mapName) {
    MapService mapService = getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    return mapServiceContext.getMapOperationProvider(mapName);
}
Also used : MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 3 with MapService

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

the class MapAddPartitionLostListenerMessageTask method call.

@Override
protected Object call() {
    final ClientEndpoint endpoint = getEndpoint();
    final MapService mapService = getService(MapService.SERVICE_NAME);
    final MapPartitionLostListener listener = new MapPartitionLostListener() {

        @Override
        public void partitionLost(MapPartitionLostEvent event) {
            if (endpoint.isAlive()) {
                ClientMessage eventMessage = MapAddPartitionLostListenerCodec.encodeMapPartitionLostEvent(event.getPartitionId(), event.getMember().getUuid());
                sendClientMessage(null, eventMessage);
            }
        }
    };
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    String registrationId;
    if (parameters.localOnly) {
        registrationId = mapServiceContext.addLocalPartitionLostListener(listener, parameters.name);
    } else {
        registrationId = mapServiceContext.addPartitionLostListener(listener, parameters.name);
    }
    endpoint.addListenerDestroyAction(MapService.SERVICE_NAME, parameters.name, registrationId);
    return registrationId;
}
Also used : MapPartitionLostListener(com.hazelcast.map.listener.MapPartitionLostListener) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) ClientEndpoint(com.hazelcast.client.ClientEndpoint) MapService(com.hazelcast.map.impl.MapService) MapPartitionLostEvent(com.hazelcast.map.MapPartitionLostEvent) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 4 with MapService

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

the class MapAssignAndGetUuidsOperation method getMetaDataGenerator.

private MetaDataGenerator getMetaDataGenerator() {
    MapService mapService = getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    return invalidator.getMetaDataGenerator();
}
Also used : MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 5 with MapService

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

the class MapEvictAllMessageTask method reduce.

@Override
protected Object reduce(Map<Integer, Object> map) {
    MapService mapService = getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    int evictedTotal = 0;
    for (Object result : map.values()) {
        Integer size = (Integer) mapServiceContext.toObject(result);
        evictedTotal += size;
    }
    if (evictedTotal > 0) {
        Address thisAddress = mapServiceContext.getNodeEngine().getThisAddress();
        MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
        mapEventPublisher.publishMapEvent(thisAddress, parameters.name, EVICT_ALL, evictedTotal);
    }
    return null;
}
Also used : Address(com.hazelcast.nio.Address) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapEventPublisher(com.hazelcast.map.impl.event.MapEventPublisher)

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