use of com.jd.blockchain.consensus.raft.rpc.RpcResponseClosure in project jdchain-core by blockchain-jd-com.
the class BlockClosure method run.
@Override
public void run(Status status) {
int i = 0;
for (Closure closure : this.getDoneList()) {
int index = i;
RpcResponseClosure submitTxDone = (RpcResponseClosure) closure;
if (submitTxDone != null) {
Utils.runClosureInThread(s -> {
if (status.isOk()) {
AsyncFuture<byte[]> future = getFuture(index);
submitTxDone.setResponse(RpcResponse.success(future.get()));
} else {
submitTxDone.setResponse(RpcResponse.fail(status.getCode(), status.getErrorMsg()));
}
submitTxDone.run(s);
});
}
i++;
}
}
Aggregations