Search in sources :

Example 1 with RaftService

use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.

the class AbstractFencedLockBasicTest method closeSession.

private void closeSession(HazelcastInstance instance, CPGroupId groupId, long sessionId) {
    RaftService service = getNodeEngineImpl(instance).getService(RaftService.SERVICE_NAME);
    service.getInvocationManager().invoke(groupId, new CloseSessionOp(sessionId)).joinInternal();
}
Also used : CloseSessionOp(com.hazelcast.cp.internal.session.operation.CloseSessionOp) RaftService(com.hazelcast.cp.internal.RaftService)

Example 2 with RaftService

use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.

the class CountDownLatchService method createProxy.

@Override
public ICountDownLatch createProxy(String proxyName) {
    try {
        proxyName = withoutDefaultGroupName(proxyName);
        RaftService service = nodeEngine.getService(RaftService.SERVICE_NAME);
        RaftGroupId groupId = service.createRaftGroupForProxy(proxyName);
        return new CountDownLatchProxy(nodeEngine, groupId, proxyName, getObjectNameForProxy(proxyName));
    } catch (Exception e) {
        throw rethrow(e);
    }
}
Also used : CountDownLatchProxy(com.hazelcast.cp.internal.datastructures.countdownlatch.proxy.CountDownLatchProxy) RaftService(com.hazelcast.cp.internal.RaftService) RaftGroupId(com.hazelcast.cp.internal.RaftGroupId)

Example 3 with RaftService

use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.

the class CPSubsystemInfoCollector method forEachMetric.

@Override
public void forEachMetric(Node node, BiConsumer<PhoneHomeMetrics, String> metricsConsumer) {
    int cpMemberCount = node.getNodeEngine().getConfig().getCPSubsystemConfig().getCPMemberCount();
    boolean cpSubsystemEnabled = cpMemberCount != 0;
    metricsConsumer.accept(PhoneHomeMetrics.CP_SUBSYSTEM_ENABLED, String.valueOf(cpSubsystemEnabled));
    if (cpSubsystemEnabled) {
        metricsConsumer.accept(PhoneHomeMetrics.CP_MEMBERS_COUNT, String.valueOf(cpMemberCount));
        RaftService raftService = node.getNodeEngine().getService(RaftService.SERVICE_NAME);
        int groupsCount = raftService.getMetadataGroupManager().getGroupIds().size();
        metricsConsumer.accept(PhoneHomeMetrics.CP_GROUPS_COUNT, String.valueOf(groupsCount));
        SemaphoreService semaphoreService = node.getNodeEngine().getService(SemaphoreService.SERVICE_NAME);
        int semaphoresCount = semaphoreService.getTotalResourcesCount();
        metricsConsumer.accept(PhoneHomeMetrics.CP_SEMAPHORES_COUNT, String.valueOf(semaphoresCount));
        CountDownLatchService clService = node.getNodeEngine().getService(CountDownLatchService.SERVICE_NAME);
        int clCount = clService.getTotalResourcesCount();
        metricsConsumer.accept(PhoneHomeMetrics.CP_COUNTDOWN_LATCHES_COUNT, String.valueOf(clCount));
        LockService lockService = node.getNodeEngine().getService(LockService.SERVICE_NAME);
        int locksCount = lockService.getTotalResourcesCount();
        metricsConsumer.accept(PhoneHomeMetrics.CP_FENCED_LOCKS_COUNT, String.valueOf(locksCount));
        AtomicLongService atomicLongService = node.getNodeEngine().getService(AtomicLongService.SERVICE_NAME);
        int atomicLongsCount = atomicLongService.getAtomicValuesCount();
        metricsConsumer.accept(PhoneHomeMetrics.CP_ATOMIC_LONGS_COUNT, String.valueOf(atomicLongsCount));
        AtomicRefService atomicRefService = node.getNodeEngine().getService(AtomicRefService.SERVICE_NAME);
        int atomicRefsCount = atomicRefService.getAtomicValuesCount();
        metricsConsumer.accept(PhoneHomeMetrics.CP_ATOMIC_REFS_COUNT, String.valueOf(atomicRefsCount));
    }
}
Also used : SemaphoreService(com.hazelcast.cp.internal.datastructures.semaphore.SemaphoreService) LockService(com.hazelcast.cp.internal.datastructures.lock.LockService) RaftService(com.hazelcast.cp.internal.RaftService) AtomicLongService(com.hazelcast.cp.internal.datastructures.atomiclong.AtomicLongService) CountDownLatchService(com.hazelcast.cp.internal.datastructures.countdownlatch.CountDownLatchService) AtomicRefService(com.hazelcast.cp.internal.datastructures.atomicref.AtomicRefService)

Example 4 with RaftService

use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.

the class PublishActiveCPMembersOp method run.

@Override
public void run() {
    RaftService service = getService();
    service.handleActiveCPMembers(metadataGroupId, membersCommitIndex, members);
}
Also used : RaftService(com.hazelcast.cp.internal.RaftService)

Example 5 with RaftService

use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.

the class MetadataRaftGroupOp method run.

@Override
public final Object run(CPGroupId groupId, long commitIndex) throws Exception {
    RaftService service = getService();
    MetadataRaftGroupManager metadataGroupManager = service.getMetadataGroupManager();
    checkTrue(metadataGroupManager.getMetadataGroupId().equals(groupId), "Cannot perform CP Subsystem management call on " + groupId);
    return run(metadataGroupManager, commitIndex);
}
Also used : MetadataRaftGroupManager(com.hazelcast.cp.internal.MetadataRaftGroupManager) RaftService(com.hazelcast.cp.internal.RaftService)

Aggregations

RaftService (com.hazelcast.cp.internal.RaftService)27 RaftGroupId (com.hazelcast.cp.internal.RaftGroupId)4 UuidUtil.newUnsecureUUID (com.hazelcast.internal.util.UuidUtil.newUnsecureUUID)3 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)3 PartitionSpecificRunnable (com.hazelcast.spi.impl.PartitionSpecificRunnable)3 OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)3 Accessors.getNodeEngineImpl (com.hazelcast.test.Accessors.getNodeEngineImpl)3 Map (java.util.Map)3 UUID (java.util.UUID)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Test (org.junit.Test)3 CPGroupDestroyedException (com.hazelcast.cp.exception.CPGroupDestroyedException)2 NotLeaderException (com.hazelcast.cp.exception.NotLeaderException)2 MetadataRaftGroupManager (com.hazelcast.cp.internal.MetadataRaftGroupManager)2 RaftInvocationManager (com.hazelcast.cp.internal.RaftInvocationManager)2 RaftOp (com.hazelcast.cp.internal.RaftOp)2 TryLockOp (com.hazelcast.cp.internal.datastructures.lock.operation.TryLockOp)2 ExpireWaitKeysOp (com.hazelcast.cp.internal.datastructures.spi.blocking.operation.ExpireWaitKeysOp)2 RaftNode (com.hazelcast.cp.internal.raft.impl.RaftNode)2 BiTuple (com.hazelcast.internal.util.BiTuple)2