From 7da624739d23a98c7a28c68acb0bbb9bf54e6ed5 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Thu, 10 Nov 2016 16:13:23 -0500 Subject: [PATCH] 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@3eb1003d5b1d4c48540e8f31249a178dd88c2d93 --- .../transport/SecurityServerTransportInterceptor.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptor.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptor.java index 67f6904a963..e0e179adb65 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptor.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptor.java @@ -259,6 +259,7 @@ public class SecurityServerTransportInterceptor implements TransportInterceptor * are invoked we restore the context. */ static final class ContextRestoreResponseHandler implements TransportResponseHandler { + private final TransportResponseHandler delegate; private final ThreadContext.StoredContext context; private final ThreadContext threadContext; @@ -296,5 +297,12 @@ public class SecurityServerTransportInterceptor implements TransportInterceptor public String executor() { return delegate.executor(); } + + @Override + public String toString() { + return getClass().getName() + "/" + delegate.toString(); + } + } + }