use of com.hazelcast.client.impl.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class HazelcastClientManager method shutdown.
public static void shutdown(HazelcastInstance instance) {
if (instance instanceof HazelcastClientProxy) {
final HazelcastClientProxy proxy = (HazelcastClientProxy) instance;
HazelcastClientInstanceImpl client = proxy.client;
if (client == null) {
return;
}
proxy.client = null;
INSTANCE.clients.remove(client.getName());
try {
client.shutdown();
} catch (Throwable ignored) {
EmptyStatement.ignore(ignored);
} finally {
OutOfMemoryErrorDispatcher.deregisterClient(client);
}
}
}
use of com.hazelcast.client.impl.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class AbstractClientCacheProxyBase method invoke.
protected ClientMessage invoke(ClientMessage clientMessage, Data keyData) {
try {
int partitionId = clientContext.getPartitionService().getPartitionId(keyData);
Future future = new ClientInvocation((HazelcastClientInstanceImpl) clientContext.getHazelcastInstance(), clientMessage, partitionId).invoke();
return (ClientMessage) future.get();
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.client.impl.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class ClientNearCacheInvalidationTest method registerInvalidationListener.
private void registerInvalidationListener(AtomicInteger counter) {
EventHandler handler = new NearCacheRepairingHandler(counter);
ListenerMessageCodec listenerCodec = createInvalidationListenerCodec();
final HazelcastClientInstanceImpl clientInstance = testContext.client.client;
clientInstance.getListenerService().registerListener(listenerCodec, handler);
}
use of com.hazelcast.client.impl.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class ProxyManagerTest method testNextAddressToSendCreateRequestOnMultipleDataMembers.
@Test
public void testNextAddressToSendCreateRequestOnMultipleDataMembers() {
final List<HazelcastInstance> instances = createNodes(3, 3);
final HazelcastInstance client = factory.newHazelcastClient();
final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
Set<Address> addresses = new HashSet<Address>();
final ProxyManager proxyManager = clientInstanceImpl.getProxyManager();
for (int i = 0; i < instances.size() * 100; i++) {
addresses.add(proxyManager.findNextAddressToSendCreateRequest());
}
assertEquals(3, addresses.size());
for (HazelcastInstance lite : instances.subList(3, 6)) {
assertContains(addresses, getAddress(lite));
}
}
use of com.hazelcast.client.impl.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class ProxyManagerTest method testNextAddressToSendCreateRequestOnSingleDataMember.
@Test
public void testNextAddressToSendCreateRequestOnSingleDataMember() {
final List<HazelcastInstance> instances = createNodes(3, 1);
final Address dataInstanceAddress = getAddress(instances.get(3));
final HazelcastInstance client = factory.newHazelcastClient();
final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
final ProxyManager proxyManager = clientInstanceImpl.getProxyManager();
for (int i = 0; i < instances.size(); i++) {
assertEquals(dataInstanceAddress, proxyManager.findNextAddressToSendCreateRequest());
}
}
Aggregations