use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class QueryCacheRecoveryUponEventLossTest method getBrokenSequences.
private Map getBrokenSequences(HazelcastInstance instance, String mapName, QueryCache queryCache) {
Node node = getNode(instance);
MapService service = node.getNodeEngine().getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = service.getMapServiceContext();
QueryCacheContext context = mapServiceContext.getQueryCacheContext();
SubscriberContext subscriberContext = context.getSubscriberContext();
MapSubscriberRegistry mapSubscriberRegistry = subscriberContext.getMapSubscriberRegistry();
SubscriberRegistry subscriberRegistry = mapSubscriberRegistry.getOrNull(mapName);
if (subscriberRegistry == null) {
return Collections.emptyMap();
}
String cacheId = ((InternalQueryCache) queryCache).getCacheId();
Accumulator accumulator = subscriberRegistry.getOrNull(cacheId);
if (accumulator == null) {
return Collections.emptyMap();
}
SubscriberAccumulator subscriberAccumulator = (SubscriberAccumulator) accumulator;
return subscriberAccumulator.getBrokenSequences();
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class AbstractRecordFactoryTest method createMapContainer.
protected MapContainer createMapContainer(boolean perEntryStatsEnabled, EvictionPolicy evictionPolicy, CacheDeserializedValues cacheDeserializedValues) {
MapConfig mapConfig = newMapConfig(perEntryStatsEnabled, evictionPolicy, cacheDeserializedValues);
NodeEngine nodeEngine = mock(NodeEngine.class);
ClusterService clusterService = mock(ClusterService.class);
MapServiceContext mapServiceContext = mock(MapServiceContext.class);
when(mapServiceContext.getNodeEngine()).thenReturn(nodeEngine);
when(nodeEngine.getClusterService()).thenReturn(clusterService);
when(clusterService.getClusterVersion()).thenReturn(Versions.CURRENT_CLUSTER_VERSION);
MapContainer mapContainer = mock(MapContainer.class);
when(mapContainer.getMapConfig()).thenReturn(mapConfig);
when(mapContainer.getEvictor()).thenReturn(evictionPolicy == EvictionPolicy.NONE ? Evictor.NULL_EVICTOR : mock(Evictor.class));
when(mapContainer.getMapServiceContext()).thenReturn(mapServiceContext);
return mapContainer;
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class NodeQueryCacheEventServiceTest method getSubscriberContext.
private static SubscriberContext getSubscriberContext(HazelcastInstance node) {
MapService mapService = getNodeEngineImpl(node).getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
return queryCacheContext.getSubscriberContext();
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class QueryCacheEventLostListenerTest method setTestSequencer.
private void setTestSequencer(HazelcastInstance instance, int eventCount) {
Node node = getNode(instance);
MapService service = node.getNodeEngine().getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = service.getMapServiceContext();
QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
queryCacheContext.setSubscriberContext(new TestSubscriberContext(queryCacheContext, eventCount, true));
}
use of com.hazelcast.map.impl.MapServiceContext in project hazelcast by hazelcast.
the class TransactionsWithWriteBehind_whenNoCoalescingQueueIsFullTest method getTotalNumOfTxnReservedCapacity.
private static long getTotalNumOfTxnReservedCapacity(String mapName, HazelcastInstance node) {
long reservedCapacity = 0;
MapServiceContext mapServiceContext = ((MapService) ((MapProxyImpl) node.getMap(mapName)).getService()).getMapServiceContext();
PartitionContainer[] partitionContainers = mapServiceContext.getPartitionContainers();
for (PartitionContainer partitionContainer : partitionContainers) {
RecordStore recordStore = partitionContainer.getExistingRecordStore(mapName);
if (recordStore != null) {
reservedCapacity += recordStore.getMapDataStore().getTxnReservedCapacityCounter().getReservedCapacityCountPerTxnId().size();
}
}
return reservedCapacity;
}
Aggregations