You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/05/25 11:36:12 UTC

[jira] [Commented] (ARTEMIS-538) [Artemis Testsuite] JMSFailoverListenerTest#testManualFailover fails

    [ https://issues.apache.org/jira/browse/ARTEMIS-538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15299917#comment-15299917 ] 

ASF GitHub Bot commented on ARTEMIS-538:
----------------------------------------

GitHub user dudaerich opened a pull request:

    https://github.com/apache/activemq-artemis/pull/538

    ARTEMIS-538 - [Artemis Testsuite] JMSFailoverListenerTest#testManualFailover fails

    ActiveMQConnection implements FailoverEventListener which executes client's
    FailoverEventListeners in separated threads in background. The old implementation
    does not guarantee ordering of their executions. The commit improves the
    implementation to guarantee it.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dudaerich/activemq-artemis ARTEMIS-538

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/538.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #538
    
----
commit fb9d09744df07a4b7a7681e6cabe38af1f675190
Author: Erich Duda <ed...@redhat.com>
Date:   2016-05-25T08:28:38Z

    ARTEMIS-538 - [Artemis Testsuite] JMSFailoverListenerTest#testManualFailover fails
    
    ActiveMQConnection implements FailoverEventListener which executes client's
    FailoverEventListeners in separated threads in background. The old implementation
    does not guarantee ordering of their executions. The commit improves the
    implementation to guarantee it.

----


> [Artemis Testsuite] JMSFailoverListenerTest#testManualFailover fails
> --------------------------------------------------------------------
>
>                 Key: ARTEMIS-538
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-538
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Erich Duda
>
> {code}
> 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)
> {code}
> I found out that problem is in \[1\]. When events occur consecutive, ordering of their executions is not guaranteed.
> \[1\]
> {code:title=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);
>                }
>             }
>          }
>       }
>    }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)