Search in sources :

Example 1 with RepairingTask

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

the class MemberMapMetaDataFetcherTest 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 2 with RepairingTask

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

the class ClientCacheMetaDataFetcherTest method fetches_sequence_and_uuid.

@Test
public void fetches_sequence_and_uuid() throws Exception {
    String cacheName = "test";
    int partition = 1;
    long givenSequence = getInt(1, MAX_VALUE);
    UUID givenUuid = UuidUtil.newSecureUUID();
    RepairingTask repairingTask = getRepairingTask(cacheName, partition, givenSequence, givenUuid);
    MetaDataFetcher metaDataFetcher = repairingTask.getMetaDataFetcher();
    ConcurrentMap<String, RepairingHandler> handlers = repairingTask.getHandlers();
    metaDataFetcher.fetchMetadata(handlers);
    RepairingHandler repairingHandler = handlers.get(getPrefixedName(cacheName));
    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 3 with RepairingTask

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

the class MapNearCacheManager method createRepairingInvalidationTask.

private RepairingTask createRepairingInvalidationTask() {
    ExecutionService executionService = nodeEngine.getExecutionService();
    ClusterService clusterService = nodeEngine.getClusterService();
    OperationService operationService = nodeEngine.getOperationService();
    HazelcastProperties properties = nodeEngine.getProperties();
    ILogger metadataFetcherLogger = nodeEngine.getLogger(MemberMapInvalidationMetaDataFetcher.class);
    InvalidationMetaDataFetcher invalidationMetaDataFetcher = new MemberMapInvalidationMetaDataFetcher(clusterService, operationService, metadataFetcherLogger);
    ILogger repairingTaskLogger = nodeEngine.getLogger(RepairingTask.class);
    UUID localUuid = nodeEngine.getLocalMember().getUuid();
    return new RepairingTask(properties, invalidationMetaDataFetcher, executionService.getGlobalTaskScheduler(), serializationService, partitionService, localUuid, repairingTaskLogger);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) ClusterService(com.hazelcast.internal.cluster.ClusterService) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) ExecutionService(com.hazelcast.spi.impl.executionservice.ExecutionService) MemberMapInvalidationMetaDataFetcher(com.hazelcast.map.impl.nearcache.invalidation.MemberMapInvalidationMetaDataFetcher) UUID(java.util.UUID) MemberMapInvalidationMetaDataFetcher(com.hazelcast.map.impl.nearcache.invalidation.MemberMapInvalidationMetaDataFetcher) InvalidationMetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.InvalidationMetaDataFetcher)

Example 4 with RepairingTask

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

the class ClientCacheInvalidationMetaDataFetcherTest method fetches_sequence_and_uuid.

@Test
public void fetches_sequence_and_uuid() {
    String cacheName = "test";
    int partition = 1;
    long givenSequence = getInt(1, MAX_VALUE);
    UUID givenUuid = UuidUtil.newUnsecureUUID();
    RepairingTask repairingTask = getRepairingTask(cacheName, partition, givenSequence, givenUuid);
    InvalidationMetaDataFetcher invalidationMetaDataFetcher = repairingTask.getInvalidationMetaDataFetcher();
    ConcurrentMap<String, RepairingHandler> handlers = repairingTask.getHandlers();
    invalidationMetaDataFetcher.fetchMetadata(handlers);
    RepairingHandler repairingHandler = handlers.get(getPrefixedName(cacheName));
    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 5 with RepairingTask

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

the class ClientCacheNearCacheLeakTest method createNearCacheContextBuilder.

private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder(CacheConfig<K, V> cacheConfig) {
    ClientConfig clientConfig = getClientConfig();
    HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
    CachingProvider provider = createClientCachingProvider(client);
    HazelcastClientCacheManager cacheManager = (HazelcastClientCacheManager) provider.getCacheManager();
    ICache<K, V> clientCache = cacheManager.createCache(DEFAULT_NEAR_CACHE_NAME, cacheConfig);
    NearCacheManager nearCacheManager = ((ClientCacheProxy) clientCache).getContext().getNearCacheManager(clientCache.getServiceName());
    String cacheNameWithPrefix = cacheManager.getCacheNameWithPrefix(DEFAULT_NEAR_CACHE_NAME);
    NearCache<Data, String> nearCache = nearCacheManager.getNearCache(cacheNameWithPrefix);
    ClientContext clientContext = ((ClientProxy) clientCache).getContext();
    RepairingTask repairingTask = clientContext.getRepairingTask(CacheService.SERVICE_NAME);
    return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new ICacheDataStructureAdapter<K, V>(clientCache)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setCacheManager(cacheManager).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) NearCacheTestContextBuilder(com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder) 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) CacheTestSupport.createClientCachingProvider(com.hazelcast.cache.CacheTestSupport.createClientCachingProvider) CacheTestSupport.createServerCachingProvider(com.hazelcast.cache.CacheTestSupport.createServerCachingProvider) CachingProvider(javax.cache.spi.CachingProvider) HazelcastClientCacheManager(com.hazelcast.client.cache.impl.HazelcastClientCacheManager)

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