public final class ContextPreservingActionListener<R> extends java.lang.Object implements ActionListener<R>
ThreadContext.StoredContext
once the listener is invokedConstructor and Description |
---|
ContextPreservingActionListener(java.util.function.Supplier<ThreadContext.StoredContext> contextSupplier,
ActionListener<R> delegate) |
Modifier and Type | Method and 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onFailure, onResponse, wrap
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