This is an automated email from the ASF dual-hosted git repository. robbie pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 3a55ac72e5d31ff3ce0546904e1afec5e6503675 Author: Robbie Gemmell <[email protected]> AuthorDate: Thu Oct 27 11:54:49 2022 +0100 ARTEMIS-4076: handle EventLoop becoming AutoClosable via ExecutorService parent on Java 19, and default method impl causing AllClassesTest to infinite loop Adds a timeout to the test to prevent similar future issues. --- .../protocol/amqp/proton/handler/ExecutorNettyAdapter.java | 9 +++++++-- .../org/apache/activemq/artemis/tests/unit/AllClassesTest.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ExecutorNettyAdapter.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ExecutorNettyAdapter.java index 9d0f09eb8a..31b10c209b 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ExecutorNettyAdapter.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/handler/ExecutorNettyAdapter.java @@ -40,7 +40,7 @@ import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; * TODO: This could be refactored out of the main codebase but at a high cost. * We may do it some day if we find an easy way that won't clutter the code too much. * */ -public class ExecutorNettyAdapter implements EventLoop { +public class ExecutorNettyAdapter implements EventLoop, AutoCloseable { final ArtemisExecutor executor; @@ -187,7 +187,7 @@ public class ExecutorNettyAdapter implements EventLoop { @Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { - return false; + return true; } @Override @@ -218,4 +218,9 @@ public class ExecutorNettyAdapter implements EventLoop { public void execute(Runnable command) { executor.execute(command); } + + @Override + public void close() { + // noop + } } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java index 7f382650d9..649c953af2 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/AllClassesTest.java @@ -80,7 +80,7 @@ public class AllClassesTest { } - @Test + @Test(timeout = 3000) public void testToString() { Object targetInstance = null;
