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.
This commit is contained in:
Robbie Gemmell 2022-10-27 11:54:49 +01:00
parent 69264aee32
commit 3a55ac72e5
2 changed files with 8 additions and 3 deletions

View File

@ -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. * 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. * 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; final ArtemisExecutor executor;
@ -187,7 +187,7 @@ public class ExecutorNettyAdapter implements EventLoop {
@Override @Override
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
return false; return true;
} }
@Override @Override
@ -218,4 +218,9 @@ public class ExecutorNettyAdapter implements EventLoop {
public void execute(Runnable command) { public void execute(Runnable command) {
executor.execute(command); executor.execute(command);
} }
@Override
public void close() {
// noop
}
} }

View File

@ -80,7 +80,7 @@ public class AllClassesTest {
} }
@Test @Test(timeout = 3000)
public void testToString() { public void testToString() {
Object targetInstance = null; Object targetInstance = null;