use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.
the class ClientContext method getRepairingTask.
public RepairingTask getRepairingTask(String serviceName) {
return getOrPutIfAbsent(repairingTasks, serviceName, name -> {
InvalidationMetaDataFetcher invalidationMetaDataFetcher = newMetaDataFetcher(serviceName);
ILogger logger = loggingService.getLogger(RepairingTask.class);
return new RepairingTask(properties, invalidationMetaDataFetcher, taskScheduler, serializationService, minimalPartitionService, clientConnectionManager.getClientUuid(), logger);
});
}
use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.
the class LiteMemberMapNearCacheLeakTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
Config configWithNearCache = getConfig(true);
HazelcastInstance liteMember = hazelcastFactory.newHazelcastInstance(configWithNearCache);
IMap<K, V> liteMemberMap = liteMember.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = getMapNearCacheManager(liteMember);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
RepairingTask repairingTask = ((MapNearCacheManager) nearCacheManager).getRepairingTask();
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(liteMember)).setNearCacheInstance(liteMember).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(liteMemberMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setRepairingTask(repairingTask);
}
use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.
the class MemberMapInvalidationMetaDataFetcherTest method fetches_sequence_and_uuid.
@Test
public void fetches_sequence_and_uuid() {
String mapName = "test";
int partition = 1;
long givenSequence = getInt(1, Integer.MAX_VALUE);
UUID givenUuid = UuidUtil.newUnsecureUUID();
RepairingTask repairingTask = getRepairingTask(mapName, partition, givenSequence, givenUuid);
InvalidationMetaDataFetcher invalidationMetaDataFetcher = repairingTask.getInvalidationMetaDataFetcher();
ConcurrentMap<String, RepairingHandler> handlers = repairingTask.getHandlers();
invalidationMetaDataFetcher.fetchMetadata(handlers);
RepairingHandler repairingHandler = handlers.get(mapName);
MetaDataContainer metaDataContainer = repairingHandler.getMetaDataContainer(partition);
UUID foundUuid = metaDataContainer.getUuid();
long foundSequence = metaDataContainer.getSequence();
assertEquals(givenSequence, foundSequence);
assertEquals(givenUuid, foundUuid);
}
use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.
the class ClientMapInvalidationMetaDataFetcherTest method fetches_sequence_and_uuid.
@Test
public void fetches_sequence_and_uuid() {
String mapName = "test";
int partition = 1;
long givenSequence = getInt(1, Integer.MAX_VALUE);
UUID givenUuid = UuidUtil.newUnsecureUUID();
RepairingTask repairingTask = getRepairingTask(mapName, partition, givenSequence, givenUuid);
InvalidationMetaDataFetcher invalidationMetaDataFetcher = repairingTask.getInvalidationMetaDataFetcher();
ConcurrentMap<String, RepairingHandler> handlers = repairingTask.getHandlers();
invalidationMetaDataFetcher.fetchMetadata(handlers);
RepairingHandler repairingHandler = handlers.get(mapName);
MetaDataContainer metaDataContainer = repairingHandler.getMetaDataContainer(partition);
UUID foundUuid = metaDataContainer.getUuid();
long foundSequence = metaDataContainer.getSequence();
assertEquals(givenSequence, foundSequence);
assertEquals(givenUuid, foundUuid);
}
use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.
the class ClientMapNearCacheLeakTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig();
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
IMap<K, V> clientMap = client.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = ((ClientMapProxy) clientMap).getContext().getNearCacheManager(clientMap.getServiceName());
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
ClientContext clientContext = ((ClientProxy) clientMap).getContext();
RepairingTask repairingTask = clientContext.getRepairingTask(MapService.SERVICE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setRepairingTask(repairingTask);
}
Aggregations