From 0a9574c9d49dfc8fdc9708cf3a6e0903a625c369 Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 19 Feb 2019 17:52:25 +0000 Subject: [PATCH] Add some missing toString() implementations (#39124) Sometimes we turn objects into strings for logging or debugging using `toString()`, but the default implementation is often unhelpful. This change improves on this in two places I ran into recently. --- .../elasticsearch/action/ActionListenerResponseHandler.java | 5 +++++ .../action/support/replication/ReplicationOperation.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/action/ActionListenerResponseHandler.java b/server/src/main/java/org/elasticsearch/action/ActionListenerResponseHandler.java index 19a0618e1c5..0966a9f1034 100644 --- a/server/src/main/java/org/elasticsearch/action/ActionListenerResponseHandler.java +++ b/server/src/main/java/org/elasticsearch/action/ActionListenerResponseHandler.java @@ -68,4 +68,9 @@ public class ActionListenerResponseHandler i public Response read(StreamInput in) throws IOException { return reader.read(in); } + + @Override + public String toString() { + return super.toString() + "/" + listener; + } } diff --git a/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java b/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java index 0da39a593a2..f001d9a29e2 100644 --- a/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java +++ b/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java @@ -196,6 +196,11 @@ public class ReplicationOperation< replicaException, ReplicationOperation.this::decPendingAndFinishIfNeeded, ReplicationOperation.this::onPrimaryDemoted, throwable -> decPendingAndFinishIfNeeded()); } + + @Override + public String toString() { + return "[" + replicaRequest + "][" + shard + "]"; + } }); }