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;
}
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);
}
}
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;
}
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;
}
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);
}
}
Aggregations