use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientCacheClearTest method registerInvalidationListener.
private void registerInvalidationListener(EventHandler handler, String nameWithPrefix) {
ListenerMessageCodec listenerCodec = createInvalidationListenerCodec(nameWithPrefix);
HazelcastClientProxy hzClient = (HazelcastClientProxy) client;
final HazelcastClientInstanceImpl clientInstance = hzClient.client;
clientInstance.getListenerService().registerListener(listenerCodec, handler);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy 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);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientCacheInvalidationMetaDataFetcherTest method getRepairingTask.
@SuppressWarnings("unchecked")
private RepairingTask getRepairingTask(String cacheName, int partition, long givenSequence, UUID givenUuid) {
HazelcastInstance member = factory.newHazelcastInstance();
distortRandomPartitionSequence(getPrefixedName(cacheName), partition, givenSequence, member);
distortRandomPartitionUuid(partition, givenUuid, member);
ClientConfig clientConfig = new ClientConfig().addNearCacheConfig(new NearCacheConfig(cacheName));
HazelcastClientProxy client = (HazelcastClientProxy) factory.newHazelcastClient(clientConfig);
CachingProvider clientCachingProvider = createClientCachingProvider(client);
Cache<Integer, Integer> clientCache = clientCachingProvider.getCacheManager().createCache(cacheName, newCacheConfig());
ClientContext clientContext = ((ClientProxy) clientCache).getContext();
return clientContext.getRepairingTask(SERVICE_NAME);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientCacheReconciliationTest method createCacheFromNewClient.
private Cache<Integer, Integer> createCacheFromNewClient(String cacheName) {
HazelcastClientProxy client = (HazelcastClientProxy) factory.newHazelcastClient(clientConfig);
CachingProvider clientCachingProvider = createClientCachingProvider(client);
CacheManager cacheManager = clientCachingProvider.getCacheManager();
Cache<Integer, Integer> cache = cacheManager.createCache(cacheName, cacheConfig);
assertInstanceOf(NearCachedClientCacheProxy.class, cache);
return cache;
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project spring-boot by spring-projects.
the class HazelcastAutoConfigurationClientTests method autoConfiguredClientConfigUsesApplicationClassLoader.
@Test
void autoConfiguredClientConfigUsesApplicationClassLoader() {
this.contextRunner.withPropertyValues("spring.hazelcast.config=org/springframework/boot/autoconfigure/" + "hazelcast/hazelcast-client-specific.xml").run((context) -> {
HazelcastInstance hazelcast = context.getBean(HazelcastInstance.class);
assertThat(hazelcast).isInstanceOf(HazelcastClientProxy.class);
ClientConfig clientConfig = ((HazelcastClientProxy) hazelcast).getClientConfig();
assertThat(clientConfig.getClassLoader()).isSameAs(context.getSourceApplicationContext().getClassLoader());
});
}
Aggregations