@Override
public CompletableFuture<Void> pingTransaction(Stream stream, UUID txId, long lease) {
Exceptions.checkNotClosed(closed.get(), this);
long traceId = LoggerHelpers.traceEnter(log, "pingTransaction", stream, txId, lease);
final CompletableFuture<PingTxnStatus> result = this.retryConfig.runAsync(() -> {
RPCAsyncCallback<PingTxnStatus> callback = new RPCAsyncCallback<>(traceId, "pingTransaction");
client.pingTransaction(PingTxnRequest.newBuilder().setStreamInfo(
ModelHelper.createStreamInfo(stream.getScope(), stream.getStreamName()))
.setTxnId(ModelHelper.decode(txId))
.setLease(lease).build(),
callback);
return callback.getFuture();
}, this.executor);
return Futures.toVoidExpecting(result,
PingTxnStatus.newBuilder().setStatus(PingTxnStatus.Status.OK).build(),
PingFailedException::new)
.whenComplete((x, e) -> {
if (e != null) {
log.warn("pingTransaction failed: ", e);
}
LoggerHelpers.traceLeave(log, "pingTransaction", traceId);
});
}