From f3e175185b68fbea01d7b4d13927ad6f5a548bd9 Mon Sep 17 00:00:00 2001 From: Mark Raynsford Date: Thu, 27 Apr 2023 13:23:26 +0000 Subject: [PATCH] Aggressively wait and log --- .../hibiscus/tests/HBClientAsynchronousTest.java | 15 +++++++++++++-- .../hibiscus/tests/HBClientSynchronousTest.java | 12 +++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientAsynchronousTest.java b/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientAsynchronousTest.java index 8902813..9616676 100644 --- a/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientAsynchronousTest.java +++ b/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientAsynchronousTest.java @@ -202,11 +202,22 @@ private void waitForClose( { LOG.debug("{}: waiting for close", this.testInfo.getDisplayName()); - while (!leakedClient.isClosed()) { + for (int index = 0; index < 1000_000_00; ++index) { + LOG.debug( + "{}: still waiting ({})", + this.testInfo.getDisplayName(), + leakedClient.stateNow() + ); + + if (leakedClient.isClosed()) { + break; + } sleep(); } - LOG.debug("{}: waited for close successfully", this.testInfo.getDisplayName()); + LOG.debug( + "{}: waited for close successfully", + this.testInfo.getDisplayName()); } private static void sleep() diff --git a/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientSynchronousTest.java b/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientSynchronousTest.java index c3cbfdd..c92b966 100644 --- a/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientSynchronousTest.java +++ b/com.io7m.hibiscus.tests/src/test/java/com/io7m/hibiscus/tests/HBClientSynchronousTest.java @@ -189,13 +189,11 @@ private void waitForClose( LOG.debug("{}: waiting for close", this.testInfo.getDisplayName()); for (int index = 0; index < 1000_000_00; ++index) { - if (index % 100 == 0) { - LOG.debug( - "{}: still waiting ({})", - this.testInfo.getDisplayName(), - leakedClient.stateNow() - ); - } + LOG.debug( + "{}: still waiting ({})", + this.testInfo.getDisplayName(), + leakedClient.stateNow() + ); if (leakedClient.isClosed()) { break;