Search in sources :

Example 6 with RepairingTask

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);
    });
}
Also used : RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) ILogger(com.hazelcast.logging.ILogger) ClientMapInvalidationMetaDataFetcher(com.hazelcast.client.map.impl.nearcache.invalidation.ClientMapInvalidationMetaDataFetcher) ClientCacheInvalidationMetaDataFetcher(com.hazelcast.client.cache.impl.nearcache.invalidation.ClientCacheInvalidationMetaDataFetcher) InvalidationMetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.InvalidationMetaDataFetcher)

Example 7 with RepairingTask

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);
}
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) IMapDataStructureAdapter(com.hazelcast.internal.adapter.IMapDataStructureAdapter)

Example 8 with 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);
}
Also used : RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) RepairingHandler(com.hazelcast.internal.nearcache.impl.invalidation.RepairingHandler) UUID(java.util.UUID) MetaDataContainer(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataContainer) InvalidationMetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.InvalidationMetaDataFetcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with RepairingTask

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);
}
Also used : RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) RepairingHandler(com.hazelcast.internal.nearcache.impl.invalidation.RepairingHandler) UUID(java.util.UUID) MetaDataContainer(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataContainer) InvalidationMetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.InvalidationMetaDataFetcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 10 with RepairingTask

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);
}
Also used : NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) ClientContext(com.hazelcast.client.impl.spi.ClientContext) Data(com.hazelcast.internal.serialization.Data) IMapDataStructureAdapter(com.hazelcast.internal.adapter.IMapDataStructureAdapter) ClientProxy(com.hazelcast.client.impl.spi.ClientProxy) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy) ClientConfig(com.hazelcast.client.config.ClientConfig) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy)

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