use of com.hazelcast.cp.internal.session.ProxySessionManagerService in project hazelcast by hazelcast.
the class CPMemberAddRemoveTest method test_sessionClosedOnCPSubsystemReset.
@Test
public void test_sessionClosedOnCPSubsystemReset() throws Exception {
HazelcastInstance[] instances = newInstances(3, 3, 1);
instances[0].getCPSubsystem().getAtomicLong("long1").set(1);
instances[0].getCPSubsystem().getAtomicLong("long1@custom").set(2);
FencedLock lock = instances[3].getCPSubsystem().getLock("lock");
lock.lock();
instances[0].getCPSubsystem().getCPSubsystemManagementService().reset().toCompletableFuture().get();
assertTrueEventually(() -> {
ProxySessionManagerService service = getNodeEngineImpl(instances[3]).getService(ProxySessionManagerService.SERVICE_NAME);
assertEquals(NO_SESSION_ID, service.getSession((RaftGroupId) lock.getGroupId()));
});
}
use of com.hazelcast.cp.internal.session.ProxySessionManagerService in project hazelcast by hazelcast.
the class AbstractFencedLockAdvancedTest method testInactiveSessionsAreEventuallyClosed.
@Test
public void testInactiveSessionsAreEventuallyClosed() throws ExecutionException, InterruptedException {
lock.lock();
RaftGroupId groupId = (RaftGroupId) lock.getGroupId();
assertTrueEventually(() -> {
for (HazelcastInstance instance : instances) {
RaftSessionService sessionService = getNodeEngineImpl(instance).getService(RaftSessionService.SERVICE_NAME);
assertFalse(sessionService.getAllSessions(groupId).get().isEmpty());
}
});
RaftSessionService sessionService = getNodeEngineImpl(primaryInstance).getService(RaftSessionService.SERVICE_NAME);
long sessionId = sessionService.getAllSessions(groupId).get().iterator().next().id();
getRaftInvocationManager(proxyInstance).invoke(groupId, new UnlockOp(objectName, sessionId, getThreadId(), newUnsecureUUID())).joinInternal();
assertTrueEventually(() -> {
for (HazelcastInstance instance : instances) {
RaftSessionService service = getNodeEngineImpl(instance).getService(RaftSessionService.SERVICE_NAME);
assertTrue(service.getAllSessions(groupId).get().isEmpty());
}
ProxySessionManagerService service = getNodeEngineImpl(proxyInstance).getService(ProxySessionManagerService.SERVICE_NAME);
assertEquals(NO_SESSION_ID, service.getSession(groupId));
});
}
Aggregations