Search in sources :

Example 11 with RepairingTask

use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.

the class ClientMapMetaDataFetcherTest method fetches_sequence_and_uuid.

@Test
public void fetches_sequence_and_uuid() throws Exception {
    String mapName = "test";
    int partition = 1;
    long givenSequence = getInt(1, Integer.MAX_VALUE);
    UUID givenUuid = UuidUtil.newSecureUUID();
    RepairingTask repairingTask = getRepairingTask(mapName, partition, givenSequence, givenUuid);
    MetaDataFetcher metaDataFetcher = repairingTask.getMetaDataFetcher();
    ConcurrentMap<String, RepairingHandler> handlers = repairingTask.getHandlers();
    metaDataFetcher.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);
}
Also used : RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) RepairingHandler(com.hazelcast.internal.nearcache.impl.invalidation.RepairingHandler) UUID(java.util.UUID) MetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataFetcher) MetaDataContainer(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataContainer) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 12 with RepairingTask

use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.

the class ClientContext method newRepairingTask.

private RepairingTask newRepairingTask(String serviceName) {
    MetaDataFetcher metaDataFetcher = newMetaDataFetcher(serviceName);
    ILogger logger = loggingService.getLogger(RepairingTask.class);
    return new RepairingTask(metaDataFetcher, executionService, minimalPartitionService, properties, localUuid, logger);
}
Also used : RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) ILogger(com.hazelcast.logging.ILogger) ClientCacheMetaDataFetcher(com.hazelcast.client.cache.impl.nearcache.invalidation.ClientCacheMetaDataFetcher) MetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataFetcher) ClientMapMetaDataFetcher(com.hazelcast.client.map.impl.nearcache.invalidation.ClientMapMetaDataFetcher)

Example 13 with RepairingTask

use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.

the class MapNearCacheLeakTest method createNearCacheContextBuilder.

private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
    Config configWithNearCache = getConfig(true);
    HazelcastInstance nearCacheInstance = hazelcastFactory.newHazelcastInstance(configWithNearCache);
    IMap<K, V> nearCacheMap = nearCacheInstance.getMap(DEFAULT_NEAR_CACHE_NAME);
    NearCacheManager nearCacheManager = getMapNearCacheManager(nearCacheInstance);
    NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
    RepairingTask repairingTask = ((MapNearCacheManager) nearCacheManager).getRepairingTask();
    return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(nearCacheInstance)).setNearCacheInstance(nearCacheInstance).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(nearCacheMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setHasLocalData(true).setRepairingTask(repairingTask);
}
Also used : NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) Data(com.hazelcast.internal.serialization.Data) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheTestContextBuilder(com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder)

Example 14 with RepairingTask

use of com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask in project hazelcast by hazelcast.

the class TxnMapNearCacheLeakTest method createNearCacheContextBuilder.

private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
    Config configWithNearCache = getConfig(true);
    HazelcastInstance nearCacheInstance = hazelcastFactory.newHazelcastInstance(configWithNearCache);
    nearCacheInstance.getMap(DEFAULT_NEAR_CACHE_NAME);
    NearCacheManager nearCacheManager = getMapNearCacheManager(nearCacheInstance);
    NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
    RepairingTask repairingTask = ((MapNearCacheManager) nearCacheManager).getRepairingTask();
    return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(nearCacheInstance)).setNearCacheInstance(nearCacheInstance).setNearCacheAdapter(new TransactionalMapDataStructureAdapter<K, V>(nearCacheInstance, DEFAULT_NEAR_CACHE_NAME)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setRepairingTask(repairingTask);
}
Also used : NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) Config(com.hazelcast.config.Config) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) TransactionalMapDataStructureAdapter(com.hazelcast.internal.adapter.TransactionalMapDataStructureAdapter) Data(com.hazelcast.internal.serialization.Data)

Aggregations

RepairingTask (com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask)14 UUID (java.util.UUID)7 MetaDataContainer (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataContainer)6 RepairingHandler (com.hazelcast.internal.nearcache.impl.invalidation.RepairingHandler)6 QuickTest (com.hazelcast.test.annotation.QuickTest)6 Test (org.junit.Test)6 NearCacheManager (com.hazelcast.internal.nearcache.NearCacheManager)5 InvalidationMetaDataFetcher (com.hazelcast.internal.nearcache.impl.invalidation.InvalidationMetaDataFetcher)5 Data (com.hazelcast.internal.serialization.Data)5 MetaDataFetcher (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataFetcher)4 Config (com.hazelcast.config.Config)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 NearCacheTestUtils.createNearCacheConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig)3 NearCacheTestUtils.getBaseConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig)3 NearCacheTestUtils.getMapNearCacheManager (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager)3 ILogger (com.hazelcast.logging.ILogger)3 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)3 ParallelTest (com.hazelcast.test.annotation.ParallelTest)3 ClientConfig (com.hazelcast.client.config.ClientConfig)2 HazelcastClientProxy (com.hazelcast.client.impl.clientside.HazelcastClientProxy)2