Fix handler name on message not fully read

Today when a message is not fully read on a response, we log (among
other details) the handler name. Unfortunately, if the handler is a
wrapper, all that we see is

o.e.x.s.t.TransportService$ContextRestoreResponseHandler@7446ba18

completely losing the offending handler. This commit adds an override
for TransportService$ContextRestoreResponseHandler#toString so that the
underlying offender can be discovered.

Relates elastic/elasticsearch#4043

Original commit: elastic/x-pack-elasticsearch@3eb1003d5b
This commit is contained in:
Jason Tedor 2016-11-10 16:13:23 -05:00 committed by GitHub
parent 0977935989
commit 7da624739d
1 changed files with 8 additions and 0 deletions

View File

@ -259,6 +259,7 @@ public class SecurityServerTransportInterceptor implements TransportInterceptor
* are invoked we restore the context. * are invoked we restore the context.
*/ */
static final class ContextRestoreResponseHandler<T extends TransportResponse> implements TransportResponseHandler<T> { static final class ContextRestoreResponseHandler<T extends TransportResponse> implements TransportResponseHandler<T> {
private final TransportResponseHandler<T> delegate; private final TransportResponseHandler<T> delegate;
private final ThreadContext.StoredContext context; private final ThreadContext.StoredContext context;
private final ThreadContext threadContext; private final ThreadContext threadContext;
@ -296,5 +297,12 @@ public class SecurityServerTransportInterceptor implements TransportInterceptor
public String executor() { public String executor() {
return delegate.executor(); return delegate.executor();
} }
@Override
public String toString() {
return getClass().getName() + "/" + delegate.toString();
}
} }
} }