public class FutureCallbackFailureHandler extends AbstractFutureCallbackFailureHandler
FutureCallback
where the result is ignored and failures are
delegated to a lambda provided at construction. This can allow you to easily do an action only
on a failure condition.
See AbstractFutureCallbackFailureHandler
for a similar implementation except using an
abstract class rather than accepting a lambda.
Constructor and Description |
---|
FutureCallbackFailureHandler(java.util.function.Consumer<java.lang.Throwable> failureHandler)
Construct a new failure handler with the provided consumer that failures will be provided to.
|
Modifier and Type | Method and Description |
---|---|
void |
handleFailure(java.lang.Throwable t)
Called once a future has completed, but completed with either a failure or a cancellation.
|
handleResult
public FutureCallbackFailureHandler(java.util.function.Consumer<java.lang.Throwable> failureHandler)
failureHandler
- Handler to be invoked as callback is invoked with failurespublic void handleFailure(java.lang.Throwable t)
FutureCallback
If the future was canceled then a CancellationException will be provided.
t
- Throwable representing the future failure.