diff --git a/core/src/main/java/org/elasticsearch/common/util/concurrent/EsThreadPoolExecutor.java b/core/src/main/java/org/elasticsearch/common/util/concurrent/EsThreadPoolExecutor.java index 1e6743e9004..4c02aab1fe8 100644 --- a/core/src/main/java/org/elasticsearch/common/util/concurrent/EsThreadPoolExecutor.java +++ b/core/src/main/java/org/elasticsearch/common/util/concurrent/EsThreadPoolExecutor.java @@ -101,19 +101,6 @@ public class EsThreadPoolExecutor extends ThreadPoolExecutor { @Override public String toString() { - /* - * ThreadPoolExecutor has some nice information in its toString but we - * can't recreate it without nastier hacks than this. - */ - String tpeToString = super.toString(); - int startOfInfoInTpeToString = tpeToString.indexOf('['); - String tpeInfo; - if (startOfInfoInTpeToString >= 0) { - tpeInfo = tpeToString.substring(startOfInfoInTpeToString + 1); - } else { - assert false: "Unsupported ThreadPoolExecutor toString"; - tpeInfo = tpeToString; - } StringBuilder b = new StringBuilder(); b.append(getClass().getSimpleName()).append('['); b.append(name).append(", "); @@ -122,7 +109,11 @@ public class EsThreadPoolExecutor extends ThreadPoolExecutor { SizeBlockingQueue queue = (SizeBlockingQueue) getQueue(); b.append("queue capacity = ").append(queue.capacity()).append(", "); } - b.append("state = ").append(tpeInfo); + /* + * ThreadPoolExecutor has some nice information in its toString but we + * can't get at it easily without just getting the toString. + */ + b.append(super.toString()).append(']'); return b.toString(); } } diff --git a/core/src/test/java/org/elasticsearch/common/util/concurrent/EsExecutorsTests.java b/core/src/test/java/org/elasticsearch/common/util/concurrent/EsExecutorsTests.java index 7c9355e4191..c7406aa9511 100644 --- a/core/src/test/java/org/elasticsearch/common/util/concurrent/EsExecutorsTests.java +++ b/core/src/test/java/org/elasticsearch/common/util/concurrent/EsExecutorsTests.java @@ -274,7 +274,7 @@ public class EsExecutorsTests extends ESTestCase { assertThat(message, containsString("of dummy runnable")); assertThat(message, containsString("on EsThreadPoolExecutor[testRejectionMessage")); assertThat(message, containsString("queue capacity = " + queue)); - assertThat(message, containsString("state = Running")); + assertThat(message, containsString("[Running")); assertThat(message, containsString("active threads = " + pool)); assertThat(message, containsString("queued tasks = " + queue)); assertThat(message, containsString("completed tasks = 0")); @@ -302,7 +302,7 @@ public class EsExecutorsTests extends ESTestCase { assertThat(message, containsString("of dummy runnable")); assertThat(message, containsString("on EsThreadPoolExecutor[" + getTestName())); assertThat(message, containsString("queue capacity = " + queue)); - assertThat(message, containsString("state = Terminated")); + assertThat(message, containsString("[Terminated")); assertThat(message, containsString("active threads = 0")); assertThat(message, containsString("queued tasks = 0")); assertThat(message, containsString("completed tasks = " + actions));