Search in sources :

Example 41 with MapService

use of com.hazelcast.map.impl.MapService 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)

Example 42 with MapService

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

the class MapRemoveMessageTask method beforeResponse.

@Override
protected void beforeResponse() {
    final long latency = System.currentTimeMillis() - startTime;
    final MapService mapService = getService(MapService.SERVICE_NAME);
    MapContainer mapContainer = mapService.getMapServiceContext().getMapContainer(parameters.name);
    if (mapContainer.getMapConfig().isStatisticsEnabled()) {
        mapService.getMapServiceContext().getLocalMapStatsProvider().getLocalMapStatsImpl(parameters.name).incrementRemoves(latency);
    }
}
Also used : MapService(com.hazelcast.map.impl.MapService) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 43 with MapService

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

the class MapSizeMessageTask method reduce.

@Override
protected Object reduce(Map<Integer, Object> map) {
    int total = 0;
    MapService mapService = getService(MapService.SERVICE_NAME);
    for (Object result : map.values()) {
        Integer size = (Integer) mapService.getMapServiceContext().toObject(result);
        total += size;
    }
    return total;
}
Also used : MapService(com.hazelcast.map.impl.MapService)

Example 44 with MapService

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

the class MapExecuteOnKeysMessageTask method reduce.

@Override
protected Object reduce(Map<Integer, Object> map) {
    List<Map.Entry<Data, Data>> entries = 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(entries);
        }
    }
    return entries;
}
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 45 with MapService

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

the class MapGetMessageTask method beforeResponse.

@Override
protected void beforeResponse() {
    final long latency = System.currentTimeMillis() - startTime;
    final MapService mapService = getService(MapService.SERVICE_NAME);
    MapContainer mapContainer = mapService.getMapServiceContext().getMapContainer(parameters.name);
    if (mapContainer.getMapConfig().isStatisticsEnabled()) {
        mapService.getMapServiceContext().getLocalMapStatsProvider().getLocalMapStatsImpl(parameters.name).incrementGets(latency);
    }
}
Also used : MapService(com.hazelcast.map.impl.MapService) MapContainer(com.hazelcast.map.impl.MapContainer)

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