From 4dd51bc1ef25c2e71edeb15a7d6e6f67476222bb Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 22 Dec 2020 13:28:30 -0500 Subject: [PATCH] NO-JIRA Adding Thread Dump to be reported on failing Wait conditions --- .../test/java/org/apache/activemq/artemis/utils/Wait.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/Wait.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/Wait.java index 85e72bb228..42cf0742cf 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/Wait.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/Wait.java @@ -68,6 +68,7 @@ public class Wait { boolean result = waitFor(() -> condition.getCount() == size, timeout, sleepMillis); if (!result) { + System.out.println(ThreadDumpUtil.threadDump("thread dump")); Assert.fail(size + " != " + condition.getCount()); } } @@ -86,6 +87,7 @@ public class Wait { boolean result = waitFor(() -> (obj == condition || obj.equals(condition.getObject())), timeout, sleepMillis); if (!result) { + System.out.println(ThreadDumpUtil.threadDump("thread dump")); Assert.assertEquals(obj, condition.getObject()); } } @@ -94,6 +96,7 @@ public class Wait { boolean result = waitFor(() -> condition.getCount() == size, timeout, sleepMillis); if (!result) { + System.out.println(ThreadDumpUtil.threadDump("thread dump")); Assert.fail(size + " != " + condition.getCount()); } } @@ -140,6 +143,7 @@ public class Wait { boolean result = waitFor(condition, duration, sleep); if (!result) { + System.out.println(ThreadDumpUtil.threadDump("thread dump")); Assert.fail(failureMessage); } } @@ -163,6 +167,9 @@ public class Wait { } conditionSatisified = condition.isSatisfied(); } + if (!conditionSatisified) { + System.out.println(ThreadDumpUtil.threadDump("thread dump")); + } return conditionSatisified; } catch (Exception e) { throw new IllegalStateException(e);