cshannon commented on code in PR #2544:
URL: https://github.com/apache/activemq/pull/2544#discussion_r4007257697
##########
activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ExceptionListenerTest.java:
##########
@@ -107,6 +108,20 @@ public boolean isSatisified() throws Exception {
assertTrue("expected exception: " + expected,
expected.getCause().getCause() instanceof SecurityException);
+ // ActiveMQConnection.onException delivers the security failure to the
+ // ExceptionListener and marks the transport failed on two independent
+ // async tasks. The listener firing above does not guarantee the
transport
+ // is failed yet, so wait for the failed state; otherwise
createSession can
+ // race a mid-dispose transport and see JMSException("Stopped.")
instead of
+ // the expected ConnectionFailedException.
+ final ActiveMQConnection amqConnection = (ActiveMQConnection)
connection;
+ Wait.waitFor(new Wait.Condition() {
Review Comment:
```suggestion
assertTrue(Wait.waitFor((Condition)
amqConnection::isTransportFailed, 5000, 10));
```
It makes sense to speed this up, the default wait can go 30 seconds and
checks every second (we should probably change the defaults in another PR).
Also you can make it a lot smaller using lambdas
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact