diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2009-09-22 03:11:56 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2009-09-22 03:11:56 +0000 |
| commit | 74e42651f2127c158e1a9d56584615eb5943acff (patch) | |
| tree | 72546ce3ccf059173395a2c875563aa40c6edb82 /qpid/java | |
| parent | 3a85e0d98801d7f0ad8435a43356791796af1a2a (diff) | |
| download | qpid-python-74e42651f2127c158e1a9d56584615eb5943acff.tar.gz | |
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
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@817487 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java b/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java index e05a7ab6e2..960661daea 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverExchangeMethod.java @@ -189,7 +189,8 @@ public class FailoverExchangeMethod implements FailoverMethod, MessageListener { synchronized (_brokerListLock) { - return _connectionDetails.getBrokerDetails(_currentBrokerIndex); + _currentBrokerDetail = _connectionDetails.getBrokerDetails(_currentBrokerIndex); + return _currentBrokerDetail; } } @@ -214,7 +215,15 @@ public class FailoverExchangeMethod implements FailoverMethod, MessageListener 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); |
