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