Package com.floragunn.searchsupport.diag
Class LogContextPreservingActionListener<R>
- java.lang.Object
-
- com.floragunn.searchsupport.diag.LogContextPreservingActionListener<R>
-
- All Implemented Interfaces:
org.elasticsearch.action.ActionListener<R>
public final class LogContextPreservingActionListener<R> extends Object implements org.elasticsearch.action.ActionListener<R>
Restores the givenThreadContext.StoredContextand the given Log4j thread context once the listener is invoked
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.action.ActionListener
org.elasticsearch.action.ActionListener.Delegating<Response extends Object,DelegateResponse extends Object>, org.elasticsearch.action.ActionListener.DelegatingActionListener<T extends Object>, org.elasticsearch.action.ActionListener.DelegatingFailureActionListener<T extends Object,R extends Object>, org.elasticsearch.action.ActionListener.MappedActionListener<Response extends Object,MappedResponse extends Object>, org.elasticsearch.action.ActionListener.RunAfterActionListener<T extends Object>, org.elasticsearch.action.ActionListener.RunBeforeActionListener<T extends Object>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonFailure(Exception e)voidonResponse(R r)StringtoString()static <R> LogContextPreservingActionListener<R>wrapPreservingContext(org.elasticsearch.action.ActionListener<R> listener, org.elasticsearch.common.util.concurrent.ThreadContext threadContext)Wraps the provided action listener in aContextPreservingActionListenerthat will also copy the response headers when theThreadContext.StoredContextis closed
-
-
-
Method Detail
-
onResponse
public void onResponse(R r)
- Specified by:
onResponsein interfaceorg.elasticsearch.action.ActionListener<R>
-
onFailure
public void onFailure(Exception e)
- Specified by:
onFailurein interfaceorg.elasticsearch.action.ActionListener<R>
-
wrapPreservingContext
public static <R> LogContextPreservingActionListener<R> wrapPreservingContext(org.elasticsearch.action.ActionListener<R> listener, org.elasticsearch.common.util.concurrent.ThreadContext threadContext)
Wraps the provided action listener in aContextPreservingActionListenerthat will also copy the response headers when theThreadContext.StoredContextis closed
-
-