Search in sources :

Example 1 with CommandType

use of com.alipay.sofa.jraft.test.atomic.server.CommandType in project sofa-jraft by sofastack.

the class BaseAsyncUserProcessor method handleRequest.

@Override
public void handleRequest(final RpcContext rpcCtx, final T request) {
    final AtomicRangeGroup group = server.getGroupBykey(request.getKey());
    if (!group.getFsm().isLeader()) {
        rpcCtx.sendResponse(group.redirect());
        return;
    }
    final CommandType cmdType = getCmdType();
    final Task task = createTask(rpcCtx, request, cmdType);
    group.getNode().apply(task);
}
Also used : Task(com.alipay.sofa.jraft.entity.Task) CommandType(com.alipay.sofa.jraft.test.atomic.server.CommandType) AtomicRangeGroup(com.alipay.sofa.jraft.test.atomic.server.AtomicRangeGroup)

Aggregations

Task (com.alipay.sofa.jraft.entity.Task)1 AtomicRangeGroup (com.alipay.sofa.jraft.test.atomic.server.AtomicRangeGroup)1 CommandType (com.alipay.sofa.jraft.test.atomic.server.CommandType)1