hono
hono copied to clipboard
Usage of Future onSuccess/onFailure/onComplete with regards to expected invocation order
Quote from https://vertx.io/docs/vertx-core/java/#_future_results:
Terminal operations like
onSuccess,onFailureandonCompleteprovide no guarantee whatsoever regarding the invocation order of callbacks. Consider a future on which 2 callbacks are registered:
future.onComplete(ar -> {
// Do something
});
future.onComplete(ar -> {
// May be invoked first
});
It is possible that the second callback is invoked before the first one.
Places in Hono code using these methods and requiring a certain invocation order need to be adapted.
Example of affected code in TenantServiceBasedX509Authentication:
.onSuccess(authInfo -> span.log("certificate validated successfully"))
.onFailure(t -> {
log.debug("validation of client certificate failed", t);
TracingHelper.logError(span, t);
})
.onComplete(ar -> span.finish());