use of com.hazelcast.client.impl.ClientEngineImpl in project hazelcast by hazelcast.
the class BackupListenerLeakTest method testBackupListenerRemoved_afterClientShutdown.
@Test
public void testBackupListenerRemoved_afterClientShutdown() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(Long.MAX_VALUE);
HazelcastInstance hazelcast = hazelcastFactory.newHazelcastInstance();
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
client.shutdown();
Map<UUID, Consumer<Long>> backupListeners = ((ClientEngineImpl) getNode(hazelcast).clientEngine).getBackupListeners();
assertTrueEventually(() -> assertEquals(0, backupListeners.size()));
}
use of com.hazelcast.client.impl.ClientEngineImpl in project hazelcast by hazelcast.
the class ClientDisconnectionOperation method run.
@Override
public void run() throws Exception {
ClientEngineImpl engine = getService();
final ClientEndpointManagerImpl endpointManager = (ClientEndpointManagerImpl) engine.getEndpointManager();
if (!engine.removeOwnershipMapping(clientUuid, memberUuid)) {
return;
}
Set<ClientEndpoint> endpoints = endpointManager.getEndpoints(clientUuid);
// This part cleans up listener and transactions
for (ClientEndpoint endpoint : endpoints) {
endpoint.getConnection().close("ClientDisconnectionOperation: Client disconnected from cluster", null);
}
// This part cleans up locks conditions semaphore etc..
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
nodeEngine.onClientDisconnected(clientUuid);
Collection<ClientAwareService> services = nodeEngine.getServices(ClientAwareService.class);
for (ClientAwareService service : services) {
service.clientDisconnected(clientUuid);
}
}
use of com.hazelcast.client.impl.ClientEngineImpl in project hazelcast by hazelcast.
the class ClientOwnershipTest method test_clientOwnedBySecondMember_afterFirstOwnerDies.
@Test
public void test_clientOwnedBySecondMember_afterFirstOwnerDies() {
HazelcastInstance instance1 = hazelcastFactory.newHazelcastInstance();
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
HazelcastInstance instance2 = hazelcastFactory.newHazelcastInstance();
instance1.shutdown();
final String instance2Uuid = instance2.getLocalEndpoint().getUuid();
final String clientUuid = client.getLocalEndpoint().getUuid();
final ClientEngineImpl clientEngine = getClientEngineImpl(instance2);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(instance2Uuid, clientEngine.getOwnerUuid(clientUuid));
}
});
}
use of com.hazelcast.client.impl.ClientEngineImpl in project hazelcast by hazelcast.
the class ClientSelectorManagementCenterClientTest method testManagementCenterClient_doesNotGetDisconnected.
@Test
public void testManagementCenterClient_doesNotGetDisconnected() {
HazelcastInstance instance = hazelcastFactory.newHazelcastInstance();
final ClientEngineImpl clientEngineImpl = getClientEngineImpl(instance);
ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty(MC_CLIENT_MODE_PROP.getName(), "true");
hazelcastFactory.newHazelcastClient(clientConfig);
clientEngineImpl.applySelector(ClientSelectors.none());
assertTrueAllTheTime(() -> {
Collection<ClientEndpoint> endpoints = clientEngineImpl.getEndpointManager().getEndpoints();
assertEquals(1, endpoints.size());
}, 10);
}
use of com.hazelcast.client.impl.ClientEngineImpl in project hazelcast by hazelcast.
the class ClientStatisticsTest method testNoUpdateWhenDisabled.
@Test
public void testNoUpdateWhenDisabled() {
HazelcastInstance hazelcastInstance = hazelcastFactory.newHazelcastInstance();
final ClientEngineImpl clientEngine = getClientEngineImpl(hazelcastInstance);
ClientConfig clientConfig = new ClientConfig();
clientConfig.getMetricsConfig().setEnabled(false).setCollectionFrequencySeconds(STATS_PERIOD_SECONDS);
hazelcastFactory.newHazelcastClient(clientConfig);
assertTrueAllTheTime(() -> {
Map<UUID, ClientStatistics> statistics = clientEngine.getClientStatistics();
assertEquals(0, statistics.size());
}, STATS_PERIOD_SECONDS * 3);
}
Aggregations