use of org.apache.ignite.raft.jraft.rpc.ActionResponse in project ignite-3 by apache.
the class RaftGroupServiceImpl method run.
/**
* {@inheritDoc}
*/
@Override
public <R> CompletableFuture<R> run(Command cmd) {
Peer leader = this.leader;
if (leader == null)
return refreshLeader().thenCompose(res -> run(cmd));
ActionRequest req = factory.actionRequest().command(cmd).groupId(groupId).readOnlySafe(true).build();
CompletableFuture<ActionResponse> fut = new CompletableFuture<>();
sendWithRetry(leader, req, currentTimeMillis() + timeout, fut);
return fut.thenApply(resp -> (R) resp.result());
}
Aggregations