Search in sources :

Example 1 with RaftSessionService

use of com.hazelcast.cp.internal.session.RaftSessionService in project hazelcast by hazelcast.

the class AbstractSemaphoreAdvancedTest method testActiveSessionIsNotClosed.

@Test
public void testActiveSessionIsNotClosed() throws InterruptedException {
    semaphore.init(1);
    semaphore.acquire();
    assertTrueEventually(() -> {
        for (HazelcastInstance instance : instances) {
            RaftSessionService sessionService = getNodeEngineImpl(instance).getService(RaftSessionService.SERVICE_NAME);
            assertFalse(sessionService.getAllSessions(getGroupId()).get().isEmpty());
        }
    });
    assertTrueAllTheTime(() -> {
        for (HazelcastInstance instance : instances) {
            RaftSessionService sessionService = getNodeEngineImpl(instance).getService(RaftSessionService.SERVICE_NAME);
            assertFalse(sessionService.getAllSessions(getGroupId()).get().isEmpty());
        }
    }, 20);
}
Also used : RaftSessionService(com.hazelcast.cp.internal.session.RaftSessionService) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Test(org.junit.Test)

Example 2 with RaftSessionService

use of com.hazelcast.cp.internal.session.RaftSessionService in project hazelcast by hazelcast.

the class HeartbeatSessionOp method run.

@Override
public Object run(CPGroupId groupId, long commitIndex) {
    RaftSessionService service = getService();
    service.heartbeat(groupId, sessionId);
    return null;
}
Also used : RaftSessionService(com.hazelcast.cp.internal.session.RaftSessionService)

Example 3 with RaftSessionService

use of com.hazelcast.cp.internal.session.RaftSessionService in project hazelcast by hazelcast.

the class ExpireSessionsOp method run.

@Override
public Object run(CPGroupId groupId, long commitIndex) {
    RaftSessionService service = getService();
    service.expireSessions(groupId, sessions);
    return null;
}
Also used : RaftSessionService(com.hazelcast.cp.internal.session.RaftSessionService)

Example 4 with RaftSessionService

use of com.hazelcast.cp.internal.session.RaftSessionService in project hazelcast by hazelcast.

the class CloseInactiveSessionsOp method run.

@Override
public Object run(CPGroupId groupId, long commitIndex) {
    RaftSessionService service = getService();
    service.closeInactiveSessions(groupId, sessions);
    return null;
}
Also used : RaftSessionService(com.hazelcast.cp.internal.session.RaftSessionService)

Example 5 with RaftSessionService

use of com.hazelcast.cp.internal.session.RaftSessionService in project hazelcast by hazelcast.

the class AbstractFencedLockAdvancedTest method testActiveSessionIsNotClosedWhenLockIsHeld.

@Test
public void testActiveSessionIsNotClosedWhenLockIsHeld() {
    lock.lock();
    assertTrueEventually(() -> {
        for (HazelcastInstance instance : instances) {
            RaftSessionService sessionService = getNodeEngineImpl(instance).getService(RaftSessionService.SERVICE_NAME);
            assertFalse(sessionService.getAllSessions(lock.getGroupId()).get().isEmpty());
        }
    });
    assertTrueAllTheTime(() -> {
        for (HazelcastInstance instance : instances) {
            RaftSessionService sessionService = getNodeEngineImpl(instance).getService(RaftSessionService.SERVICE_NAME);
            assertFalse(sessionService.getAllSessions(lock.getGroupId()).get().isEmpty());
        }
    }, 20);
}
Also used : RaftSessionService(com.hazelcast.cp.internal.session.RaftSessionService) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Test(org.junit.Test)

Aggregations

RaftSessionService (com.hazelcast.cp.internal.session.RaftSessionService)9 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 Test (org.junit.Test)6 RaftGroupId (com.hazelcast.cp.internal.RaftGroupId)2 RaftOp (com.hazelcast.cp.internal.RaftOp)1 UnlockOp (com.hazelcast.cp.internal.datastructures.lock.operation.UnlockOp)1 ReleasePermitsOp (com.hazelcast.cp.internal.datastructures.semaphore.operation.ReleasePermitsOp)1 AbstractProxySessionManager (com.hazelcast.cp.internal.session.AbstractProxySessionManager)1 ProxySessionManagerService (com.hazelcast.cp.internal.session.ProxySessionManagerService)1 FencedLock (com.hazelcast.cp.lock.FencedLock)1