Ir al contenido

Async Error Swallowed (ARCH4169)

Esta página aún no está disponible en tu idioma.

Key java.logging.future-exception-unhandled · Severity warning · Category logging

Starting a CompletableFuture chain with no error handler lets an async failure vanish silently. The exception is neither logged nor reaches the caller; the failure stays completely invisible.

CompletableFuture.supplyAsync(() -> repository.load(id))
.thenAccept(cache::put);
CompletableFuture.supplyAsync(() -> repository.load(id))
.thenAccept(cache::put)
.exceptionally(e -> {
log.error("Async load failed: {}", id, e);
return null;
});

Attach an error handler with exceptionally/handle to every async chain so rejections are logged.