ActionListener<R>
public final class ContextPreservingActionListener<R> extends java.lang.Object implements ActionListener<R>
ThreadContext.StoredContext
once the listener is invokedConstructor | Description |
---|---|
ContextPreservingActionListener(java.util.function.Supplier<ThreadContext.StoredContext> contextSupplier,
ActionListener<R> delegate) |
Modifier and Type | Method | Description |
---|---|---|
void |
onFailure(java.lang.Exception e) |
A failure caused by an exception at some phase of the task.
|
void |
onResponse(R r) |
Handle action response.
|
static <R> ContextPreservingActionListener<R> |
wrapPreservingContext(ActionListener<R> listener,
ThreadContext threadContext) |
Wraps the provided action listener in a
ContextPreservingActionListener that will
also copy the response headers when the ThreadContext.StoredContext is closed |
public ContextPreservingActionListener(java.util.function.Supplier<ThreadContext.StoredContext> contextSupplier, ActionListener<R> delegate)
public void onResponse(R r)
ActionListener
onResponse
in interface ActionListener<R>
public void onFailure(java.lang.Exception e)
ActionListener
onFailure
in interface ActionListener<R>
public static <R> ContextPreservingActionListener<R> wrapPreservingContext(ActionListener<R> listener, ThreadContext threadContext)
ContextPreservingActionListener
that will
also copy the response headers when the ThreadContext.StoredContext
is closed