use of com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class ClientTestSupport method blockMessagesFromInstance.
/**
* Blocks incoming messages to client from given instance
*/
protected void blockMessagesFromInstance(HazelcastInstance instance, HazelcastInstance client) {
HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
ClientConnectionManager connectionManager = clientImpl.getConnectionManager();
Address address = instance.getCluster().getLocalMember().getAddress();
((TestClientRegistry.MockTcpClientConnectionManager) connectionManager).blockFrom(address);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class ClientTestSupport method unblockMessagesToInstance.
/**
* Unblocks outgoing messages from client to given instance
*/
protected void unblockMessagesToInstance(HazelcastInstance instance, HazelcastInstance client) {
HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
ClientConnectionManager connectionManager = clientImpl.getConnectionManager();
Address address = instance.getCluster().getLocalMember().getAddress();
((TestClientRegistry.MockTcpClientConnectionManager) connectionManager).unblockTo(address);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class ClientTestSupport method unblockMessagesFromInstance.
/**
* Unblocks incoming messages to client from given instance
*/
protected void unblockMessagesFromInstance(HazelcastInstance instance, HazelcastInstance client) {
HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
ClientConnectionManager connectionManager = clientImpl.getConnectionManager();
Address address = instance.getCluster().getLocalMember().getAddress();
((TestClientRegistry.MockTcpClientConnectionManager) connectionManager).unblockFrom(address);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class HazelcastClient method shutdownAll.
/**
* Shuts down all the client HazelcastInstance created in this JVM.
* <p>
* To be more precise it shuts down the HazelcastInstances loaded using the same classloader this HazelcastClient has been
* loaded with.
* <p>
* This method is mostly used for testing purposes.
*
* @see #getAllHazelcastClients()
*/
public static void shutdownAll() {
for (InstanceFuture<HazelcastClientProxy> future : CLIENTS.values()) {
try {
HazelcastClientProxy proxy = future.get();
HazelcastClientInstanceImpl client = proxy.client;
if (client == null) {
continue;
}
proxy.client = null;
client.shutdown();
} catch (Throwable ignored) {
EmptyStatement.ignore(ignored);
}
}
OutOfMemoryErrorDispatcher.clearClients();
CLIENTS.clear();
}
use of com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl in project hazelcast by hazelcast.
the class HazelcastClient method shutdown.
/**
* Shutdown the provided client and remove it from the managed list
*
* @param instanceName the hazelcast client instance name
*/
public static void shutdown(String instanceName) {
InstanceFuture<HazelcastClientProxy> future = CLIENTS.remove(instanceName);
if (future == null || !future.isSet()) {
return;
}
HazelcastClientProxy proxy = future.get();
HazelcastClientInstanceImpl client = proxy.client;
if (client == null) {
return;
}
proxy.client = null;
try {
client.shutdown();
} catch (Throwable ignored) {
EmptyStatement.ignore(ignored);
} finally {
OutOfMemoryErrorDispatcher.deregisterClient(client);
}
}
Aggregations