jeanouii commented on code in PR #1621:
URL: https://github.com/apache/activemq/pull/1621#discussion_r2709820927
##########
activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java:
##########
@@ -165,6 +165,22 @@ public boolean isSatisified() throws Exception {
transportConnector.start();
+ // Wait for failover to reconnect and recover() to succeed
+ // The ReconnectingXAResource should handle reconnection
transparently
+ final XAResource resource = resources[0];
+ assertTrue("connection re-established and can recover",
Wait.waitFor(new Wait.Condition() {
+ @Override
+ public boolean isSatisified() throws Exception {
+ try {
+ resource.recover(100);
+ return true;
+ } catch (Exception e) {
+ // Still reconnecting
+ return false;
+ }
+ }
+ }, 30000, 500));
Review Comment:
You're absolutely right about using TimeUnit - I've updated the code for
clarity.
I've calculated the values actually :-)
maxReconnectAttempts=10 and exponential backoff up to 30s for the
maxReconnectDelay
In practice it's a few seconds, so 30s is more than enough even on a slow
machine.
I've added a timeout to the test itself in case.
--
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