use of io.dingodb.raft.rpc.impl.FutureImpl in project dingo by dingodb.
the class DefaultRaftClientService method onConnectionFail.
// fail-fast when no connection
private Future<Message> onConnectionFail(final Endpoint endpoint, final Message request, Closure done, final Executor executor) {
final FutureImpl<Message> future = new FutureImpl<>();
executor.execute(() -> {
final String fmt = "Check connection[%s] fail and try to create new one";
if (done != null) {
try {
done.run(new Status(RaftError.EINTERNAL, fmt, endpoint));
} catch (final Throwable t) {
LOG.error("Fail to run RpcResponseClosure, the request is {}.", request, t);
}
}
if (!future.isDone()) {
future.failure(new RemotingException(String.format(fmt, endpoint)));
}
});
return future;
}
Aggregations