Search in sources :

Example 6 with RaftService

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

the class GetLeadedGroupsOp method run.

@Override
public void run() throws Exception {
    RaftService service = getService();
    groups = service.getLeadedGroups();
}
Also used : RaftService(com.hazelcast.cp.internal.RaftService)

Example 7 with RaftService

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

the class RaftReplicateOp method run.

@Override
public final void run() {
    RaftService service = getService();
    RaftNode raftNode = service.getOrInitRaftNode(groupId);
    if (raftNode == null) {
        if (service.isRaftGroupDestroyed(groupId)) {
            sendResponse(new CPGroupDestroyedException(groupId));
        } else {
            sendResponse(new NotLeaderException(groupId, service.getLocalCPEndpoint(), null));
        }
        return;
    } else if (raftNode.getStatus() == RaftNodeStatus.STEPPED_DOWN) {
        sendResponse(new NotLeaderException(groupId, service.getLocalCPEndpoint(), null));
        getNodeEngine().getExecutionService().execute(CP_SUBSYSTEM_EXECUTOR, () -> service.stepDownRaftNode(groupId));
        return;
    }
    replicate(raftNode).whenCompleteAsync(this, CALLER_RUNS);
}
Also used : NotLeaderException(com.hazelcast.cp.exception.NotLeaderException) RaftService(com.hazelcast.cp.internal.RaftService) CPGroupDestroyedException(com.hazelcast.cp.exception.CPGroupDestroyedException) RaftNode(com.hazelcast.cp.internal.raft.impl.RaftNode)

Example 8 with RaftService

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

the class TransferLeadershipOp method call.

@Override
public CallStatus call() throws Exception {
    RaftService service = getService();
    InternalCompletableFuture future = service.transferLeadership(groupId, (CPMemberInfo) destination);
    future.whenCompleteAsync(this);
    return CallStatus.VOID;
}
Also used : RaftService(com.hazelcast.cp.internal.RaftService) InternalCompletableFuture(com.hazelcast.spi.impl.InternalCompletableFuture)

Example 9 with RaftService

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

the class AppendRequestOp method run.

@Override
public void run() {
    RaftService service = getService();
    service.handleAppendEntries(groupId, appendRequest, target);
}
Also used : RaftService(com.hazelcast.cp.internal.RaftService)

Example 10 with RaftService

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

the class PreVoteRequestOp method run.

@Override
public void run() {
    RaftService service = getService();
    service.handlePreVoteRequest(groupId, voteRequest, target);
}
Also used : 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