Hi Rajith,
Will this not cause both the 0-8 and 0-10 code path to throw a
NullPointer if none of the brokers are available on startup.
Is the FailoverPolicy cycle count not what stops the looping?

Regards
Martin

2009/9/22  <[email protected]>:
> Author: rajith
> Date: Tue Sep 22 03:11:56 2009
> New Revision: 817487
>
> URL: http://svn.apache.org/viewvc?rev=817487&view=rev
> Log:
> This is a fix for QPID-1956
> Added a check in the getNextBrokerDetails method to return null when the 
> current broker equals the only remaining broker in the list
> A test case for this will be added once I finalized the test case for the 
> failover exchange method
>
> Modified:
>    
> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java
>
> Modified: 
> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java
> URL: 
> http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java?rev=817487&r1=817486&r2=817487&view=diff
> ==============================================================================
> --- 
> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java
>  (original)
> +++ 
> qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java
>  Tue Sep 22 03:11:56 2009
> @@ -189,7 +189,8 @@
>     {
>         synchronized (_brokerListLock)
>         {
> -            return _connectionDetails.getBrokerDetails(_currentBrokerIndex);
> +            _currentBrokerDetail = 
> _connectionDetails.getBrokerDetails(_currentBrokerIndex);
> +            return _currentBrokerDetail;
>         }
>     }
>
> @@ -214,7 +215,15 @@
>                 broker.getHost().equals(_currentBrokerDetail.getHost()) &&
>                 broker.getPort() == _currentBrokerDetail.getPort())
>             {
> -                return getNextBrokerDetails();
> +                if (_connectionDetails.getBrokerCount() > 1)
> +                {
> +                    return getNextBrokerDetails();
> +                }
> +                else
> +                {
> +                    _failedAttemps ++;
> +                    return null;
> +                }
>             }
>
>             String delayStr = 
> broker.getProperty(BrokerDetails.OPTIONS_CONNECT_DELAY);
>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:[email protected]
>
>



-- 
Martin Ritchie

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to