Package io.foldright.cffu2.eh
Class SwallowedExceptionHandleUtils
java.lang.Object
io.foldright.cffu2.eh.SwallowedExceptionHandleUtils
Utilities to handle swallowed exceptions from MULTIPLE
CompletionStage
s
(including CompletableFuture
s and Cffu
s).
These utilities are designed for noncritical tasks like reporting and logging exceptions. For business logic
exception handling, use the standard exception handling methods for SINGLE CompletionStage
s instead: exceptionally
, catching
, or handle
.
- Author:
- Jerry Lee (oldratlee at gmail dot com)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExceptionHandler
Returns an exception handler that logs swallowed exceptions from CompletionStages at warning level using the cffu logger.static void
handleAllSwallowedExceptions
(String where, ExceptionHandler exceptionHandler, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStage
s as swallowed exceptions, calling back the exceptionHandler with null attachment.static void
handleAllSwallowedExceptions
(String where, Object[] attachments, ExceptionHandler exceptionHandler, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStage
s as swallowed exceptions.static void
handleAllSwallowedExceptions
(String where, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStage
s as swallowed exceptions, usingcffuSwallowedExceptionHandler()
and calling back it with null attachment.static void
handleSwallowedExceptions
(String where, ExceptionHandler exceptionHandler, CompletionStage<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStage
s that are discarded (not propagated) by the outputCompletionStage
, calling back the exceptionHandler with null attachment.static void
handleSwallowedExceptions
(String where, Object[] attachments, ExceptionHandler exceptionHandler, CompletionStage<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStage
s that are discarded (not propagated) by the outputCompletionStage
.static void
handleSwallowedExceptions
(String where, CompletionStage<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStage
s that are discarded (not propagated) by the outputCompletionStage
, usingcffuSwallowedExceptionHandler()
and calling back it with null attachment.
-
Method Details
-
handleAllSwallowedExceptions
Handles all exceptions from multiple inputCompletionStage
s as swallowed exceptions, usingcffuSwallowedExceptionHandler()
and calling back it with null attachment.- Parameters:
where
- the location where the exception occurs
-
handleAllSwallowedExceptions
public static void handleAllSwallowedExceptions(String where, ExceptionHandler exceptionHandler, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStage
s as swallowed exceptions, calling back the exceptionHandler with null attachment.- Parameters:
where
- the location where the exception occursexceptionHandler
- the exception handler
-
handleAllSwallowedExceptions
public static void handleAllSwallowedExceptions(String where, @Nullable Object[] attachments, ExceptionHandler exceptionHandler, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStage
s as swallowed exceptions.- Parameters:
where
- the location where the exception occursattachments
- the attachment objectsexceptionHandler
- the exception handler
-
handleSwallowedExceptions
public static void handleSwallowedExceptions(String where, CompletionStage<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStage
s that are discarded (not propagated) by the outputCompletionStage
, usingcffuSwallowedExceptionHandler()
and calling back it with null attachment.- Parameters:
where
- the location where the exception occurs
-
handleSwallowedExceptions
public static void handleSwallowedExceptions(String where, ExceptionHandler exceptionHandler, CompletionStage<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStage
s that are discarded (not propagated) by the outputCompletionStage
, calling back the exceptionHandler with null attachment.- Parameters:
where
- the location where the exception occursexceptionHandler
- the exception handler
-
handleSwallowedExceptions
public static void handleSwallowedExceptions(String where, @Nullable Object[] attachments, ExceptionHandler exceptionHandler, CompletionStage<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStage
s that are discarded (not propagated) by the outputCompletionStage
.- Parameters:
where
- the location where the exception occursattachments
- the attachment objectsexceptionHandler
- the exception handler
-
cffuSwallowedExceptionHandler
Returns an exception handler that logs swallowed exceptions from CompletionStages at warning level using the cffu logger.
-