Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-5981

(7.0.z) [Artemis Testsuite] JMSFailoverListenerTest#testManualFailover fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.2.0.GA.CR1
    • 7.0.0.GA
    • ActiveMQ
    • None

      java.lang.AssertionError: expected:<FAILURE_DETECTED> but was:<FAILOVER_FAILED>
      	at org.junit.Assert.fail(Assert.java:88)
      	at org.junit.Assert.failNotEquals(Assert.java:743)
      	at org.junit.Assert.assertEquals(Assert.java:118)
      	at org.junit.Assert.assertEquals(Assert.java:144)
      	at org.apache.activemq.artemis.tests.integration.jms.cluster.JMSFailoverListenerTest.testManualFailover(JMSFailoverListenerTest.java:228)
      

      I found out that problem is in [1]. When events occur consecutive, ordering of their executions is not guaranteed.

      [1]

      ActiveMQConnection.java
      private static class FailoverEventListenerImpl implements FailoverEventListener {
      
            private final WeakReference<ActiveMQConnection> connectionRef;
      
            FailoverEventListenerImpl(final ActiveMQConnection connection) {
               connectionRef = new WeakReference<ActiveMQConnection>(connection);
            }
      
            @Override
            public void failoverEvent(final FailoverEventType eventType) {
               ActiveMQConnection conn = connectionRef.get();
      
               if (conn != null) {
                  try {
                     final FailoverEventListener failoverListener = conn.getFailoverListener();
      
                     if (failoverListener != null) {
      
                        new Thread(new Runnable() {
                           public void run() {
                              failoverListener.failoverEvent(eventType);
                           }
                        }).start();
                     }
                  }
                  catch (JMSException e) {
                     if (!conn.closed) {
                        ActiveMQJMSClientLogger.LOGGER.errorCallingFailoverListener(e);
                     }
                  }
               }
      
            }
         }
      

              mstefank Martin Stefanko
              eduda_jira Erich Duda (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: