Search in sources :

Example 16 with RaftService

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

the class UnsafeRaftReplicateOp method handleResponse.

@Override
CallStatus handleResponse(long commitIndex, Object response) {
    if (response == PostponedResponse.INSTANCE) {
        RaftService service = getService();
        service.registerUnsafeWaitingOperation(groupId, commitIndex, this);
        return CallStatus.VOID;
    }
    return CallStatus.RESPONSE;
}
Also used : RaftService(com.hazelcast.cp.internal.RaftService)

Example 17 with RaftService

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

the class RaftQueryOp method run.

@Override
public final void run() {
    RaftService service = getService();
    RaftNode raftNode = service.getRaftNode(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;
    }
    if (op instanceof RaftNodeAware) {
        ((RaftNodeAware) op).setRaftNode(raftNode);
    }
    raftNode.query(op, queryPolicy).whenCompleteAsync(this, CALLER_RUNS);
}
Also used : RaftNodeAware(com.hazelcast.cp.internal.RaftNodeAware) 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 18 with RaftService

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

the class AppendFailureResponseOp method run.

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

Example 19 with RaftService

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

the class InstallSnapshotOp method run.

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

Example 20 with RaftService

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

the class VoteRequestOp method run.

@Override
public void run() {
    RaftService service = getService();
    service.handleVoteRequest(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