use of com.hazelcast.cache.impl.HazelcastServerCachingProvider in project hazelcast by hazelcast.
the class CacheCreationTest method creatingASingleCacheFromMultiProviders.
@Test
public void creatingASingleCacheFromMultiProviders() throws URISyntaxException, InterruptedException {
ExecutorService executorService = Executors.newFixedThreadPool(THREAD_COUNT);
final CountDownLatch latch = new CountDownLatch(THREAD_COUNT);
for (int i = 0; i < THREAD_COUNT; i++) {
executorService.execute(new Runnable() {
@Override
public void run() {
HazelcastServerCachingProvider cachingProvider = createCachingProvider(hzConfig);
Cache<Object, Object> cache = cachingProvider.getCacheManager().getCache("xmlCache");
cache.get(1);
latch.countDown();
}
});
}
HazelcastTestSupport.assertOpenEventually(latch);
executorService.shutdown();
}
use of com.hazelcast.cache.impl.HazelcastServerCachingProvider in project hazelcast by hazelcast.
the class CachePartitionLostListenerConfigTest method testCachePartitionLostListener_registeredViaImplementationInConfigObject.
@Test
public void testCachePartitionLostListener_registeredViaImplementationInConfigObject() {
final String cacheName = "myCache";
Config config = new Config();
CacheSimpleConfig cacheConfig = config.getCacheConfig(cacheName);
CachePartitionLostListener listener = mock(CachePartitionLostListener.class);
cacheConfig.addCachePartitionLostListenerConfig(new CachePartitionLostListenerConfig(listener));
cacheConfig.setBackupCount(0);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
HazelcastInstance instance = factory.newHazelcastInstance(config);
HazelcastServerCachingProvider cachingProvider = createCachingProvider(instance);
CacheManager cacheManager = cachingProvider.getCacheManager();
cacheManager.getCache(cacheName);
final EventService eventService = getNode(instance).getNodeEngine().getEventService();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
Collection<EventRegistration> registrations = eventService.getRegistrations(CacheService.SERVICE_NAME, cacheName);
assertFalse(registrations.isEmpty());
}
});
}
Aggregations