use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class NearCachedClientMapProxy method getConnectedServerVersion.
private int getConnectedServerVersion() {
ClientContext clientContext = getClientContext();
ClientClusterService clusterService = clientContext.getClusterService();
Address ownerConnectionAddress = clusterService.getOwnerConnectionAddress();
HazelcastClientInstanceImpl client = getClient();
ClientConnectionManager connectionManager = client.getConnectionManager();
Connection connection = connectionManager.getConnection(ownerConnectionAddress);
if (connection == null) {
logger.warning(format("No owner connection is available, " + "near cached cache %s will be started in legacy mode", name));
return UNKNOWN_HAZELCAST_VERSION;
}
return ((ClientConnection) connection).getConnectedServerVersion();
}
use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class ClientMapMetaDataFetcherTest method getRepairingTask.
private RepairingTask getRepairingTask(String mapName, int partition, long givenSequence, UUID givenUuid) {
HazelcastInstance member = factory.newHazelcastInstance();
distortRandomPartitionSequence(mapName, partition, givenSequence, member);
distortRandomPartitionUuid(partition, givenUuid, member);
ClientConfig clientConfig = new ClientConfig().addNearCacheConfig(new NearCacheConfig(mapName));
HazelcastInstance client = factory.newHazelcastClient(clientConfig);
IMap<Integer, Integer> clientMap = client.getMap(mapName);
ClientContext clientContext = ((NearCachedClientMapProxy) clientMap).getClientContext();
return clientContext.getRepairingTask(SERVICE_NAME);
}
use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class ClientCacheMetaDataFetcherTest method getRepairingTask.
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 = HazelcastClientCachingProvider.createCachingProvider(client);
Cache<Integer, Integer> clientCache = clientCachingProvider.getCacheManager().createCache(cacheName, newCacheConfig());
ClientContext clientContext = ((ClientCacheProxy) clientCache).getClientContext();
return clientContext.getRepairingTask(SERVICE_NAME);
}
use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceProxy method onInitialize.
@Override
protected void onInitialize() {
ClientContext context = getContext();
ClientPartitionService partitionService = context.getPartitionService();
partitionCount = partitionService.getPartitionCount();
}
Aggregations