Search in sources :

Example 21 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 22 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)

Example 23 with MapService

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

the class AbstractMapAddEntryListenerMessageTask method call.

@Override
protected Object call() {
    final ClientEndpoint endpoint = getEndpoint();
    final MapService mapService = getService(MapService.SERVICE_NAME);
    Object listener = newMapListener();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    String name = getDistributedObjectName();
    EventFilter eventFilter = getEventFilter();
    String registrationId;
    if (isLocalOnly()) {
        registrationId = mapServiceContext.addLocalEventListener(listener, eventFilter, name);
    } else {
        registrationId = mapServiceContext.addEventListener(listener, eventFilter, name);
    }
    endpoint.addListenerDestroyAction(MapService.SERVICE_NAME, name, registrationId);
    return registrationId;
}
Also used : ClientEndpoint(com.hazelcast.client.ClientEndpoint) MapService(com.hazelcast.map.impl.MapService) EventFilter(com.hazelcast.spi.EventFilter) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 24 with MapService

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

the class MapExecuteWithPredicateMessageTask method reduce.

@Override
protected Object reduce(Map<Integer, Object> map) {
    List<Map.Entry<Data, Data>> dataMap = new ArrayList<Map.Entry<Data, Data>>();
    MapService mapService = getService(MapService.SERVICE_NAME);
    for (Object o : map.values()) {
        if (o != null) {
            MapEntries mapEntries = (MapEntries) mapService.getMapServiceContext().toObject(o);
            mapEntries.putAllToList(dataMap);
        }
    }
    return dataMap;
}
Also used : MapEntries(com.hazelcast.map.impl.MapEntries) ArrayList(java.util.ArrayList) Data(com.hazelcast.nio.serialization.Data) MapService(com.hazelcast.map.impl.MapService) Map(java.util.Map)

Example 25 with MapService

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

the class MapFlushMessageTask method call.

@Override
protected Object call() throws Exception {
    MapService mapService = getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    ProxyService proxyService = nodeEngine.getProxyService();
    DistributedObject distributedObject = proxyService.getDistributedObject(SERVICE_NAME, parameters.name);
    MapProxyImpl mapProxy = (MapProxyImpl) distributedObject;
    mapProxy.flush();
    return null;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) DistributedObject(com.hazelcast.core.DistributedObject) ProxyService(com.hazelcast.spi.ProxyService) MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

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