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 subversion and git services (JIRA)" <ji...@apache.org> on 2016/07/19 21:27:20 UTC

[jira] [Commented] (AMQ-6273) ReconnectionPolicy.getNextDelay(int attempt) always returns zero when maxReconnectAttempts/maxInitialConnectAttempts == ReconnectionPolicy.INFINITE

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

ASF subversion and git services commented on AMQ-6273:
------------------------------------------------------

Commit e05db7cb5c82660d83e913fa6df77a9e23d0eb8f in activemq's branch refs/heads/master from [~tabish121]
[ https://git-wip-us.apache.org/repos/asf?p=activemq.git;h=e05db7c ]

https://issues.apache.org/jira/browse/AMQ-6273

increment the connect attempt count explicitly to ensure reconnect
policy options are applied. 

> ReconnectionPolicy.getNextDelay(int attempt) always returns zero when maxReconnectAttempts/maxInitialConnectAttempts == ReconnectionPolicy.INFINITE
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-6273
>                 URL: https://issues.apache.org/jira/browse/AMQ-6273
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.12.1
>         Environment: WebLogic 10.3.6, HotSpot JDK 1.7
>            Reporter: Ben Nisbet
>             Fix For: 5.14.0
>
>
> The v.5.12.1 release of class org.apache.activemq.network.jms.JmsConnector contains a defect within method *private void doInitializeConnection(boolean local) throws Exception* that causes the *attempt* variable to
>  always retain a value of zero if ReconnectionPolicy.maxReconnectAttempts/maxInitialConnectAttempts == ReconnectionPolicy.INFINITE. (irrespective of the actual number of loop iterations)
> This indirectly prevents the connector from using any of the following ReconnectionPolicy configuration properties:
> private long initialReconnectDelay = 1000L;
> private long maximumReconnectDelay = 30000;
> private boolean useExponentialBackOff = false;
> private double backOffMultiplier = 2.0;
> The defect is triggered by inclusion of increment operator for *attempt* variable within do/while loop condition evaluation.  Line 630 of class JmsConnector uses short-circuit evaluation and this prevents value from being incremented whenever maxRetries == INFINITE  evaluates to true:
> *while ((maxRetries == INFINITE || maxRetries > ++attempt) && !connectionService.isShutdown());*



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