Package io.foldright.cffu2.eh
Class SwallowedExceptionHandleUtils
java.lang.Object
io.foldright.cffu2.eh.SwallowedExceptionHandleUtils
Utilities to handle swallowed exceptions from MULTIPLE
CompletionStages
(including CompletableFutures and Cffus).
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 CompletionStages instead: exceptionally, catching, or handle.
- Author:
- Jerry Lee (oldratlee at gmail dot com)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExceptionHandlerReturns an exception handler that logs swallowed exceptions from CompletionStages at warning level using the cffu logger.static voidhandleAllSwallowedExceptions(String where, ExceptionHandler exceptionHandler, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStages as swallowed exceptions, calling back the exceptionHandler with null attachment.static voidhandleAllSwallowedExceptions(String where, Object[] attachments, ExceptionHandler exceptionHandler, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStages as swallowed exceptions.static voidhandleAllSwallowedExceptions(String where, CompletionStage<?>... inputs) Handles all exceptions from multiple inputCompletionStages as swallowed exceptions, usingcffuSwallowedExceptionHandler()and calling back it with null attachment.static voidhandleSwallowedExceptions(String where, ExceptionHandler exceptionHandler, CompletableFuture<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStages that are discarded (not propagated) by the outputCompletionStage, calling back the exceptionHandler with null attachment.static voidhandleSwallowedExceptions(String where, Object[] attachments, ExceptionHandler exceptionHandler, CompletableFuture<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStages that are discarded (not propagated) by the outputCompletionStage.static voidhandleSwallowedExceptions(String where, CompletableFuture<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStages that are discarded (not propagated) by the outputCompletionStage, usingcffuSwallowedExceptionHandler()and calling back it with null attachment.
-
Method Details
-
handleAllSwallowedExceptions
Handles all exceptions from multiple inputCompletionStages 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 inputCompletionStages 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 inputCompletionStages as swallowed exceptions.- Parameters:
where- the location where the exception occursattachments- the attachment objectsexceptionHandler- the exception handler
-
handleSwallowedExceptions
public static void handleSwallowedExceptions(String where, CompletableFuture<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStages 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, CompletableFuture<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStages 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, CompletableFuture<?> output, CompletionStage<?>... inputs) Handles swallowed exceptions from multiple inputCompletionStages 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.
-