summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-06-28 11:00:08 +0000
committerRobert Gemmell <robbie@apache.org>2012-06-28 11:00:08 +0000
commitd5a5322d7c9644308a159d6f5d1f24c6e289bf1f (patch)
treebdb3fc659c704e3304fa077ac4a6c2eb699fe1ea
parent94acbd4186201188e13a358cfac04f64bfe53f4e (diff)
downloadqpid-python-d5a5322d7c9644308a159d6f5d1f24c6e289bf1f.tar.gz
QPID-4080: close initial connections after use rather than allowing them to fail over after we no longer need them, which causes them to sporadically expose QPID-4086 during teardown.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1354912 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
index 88f79e8823..408643b98a 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
@@ -20,7 +20,6 @@
package org.apache.qpid.server.store.berkeleydb;
import java.io.File;
-import java.io.IOException;
import java.util.Set;
import javax.jms.Connection;
@@ -35,8 +34,6 @@ import org.apache.log4j.Logger;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.url.URLSyntaxException;
-import com.sleepycat.je.rep.ReplicationConfig;
-
/**
* The HA white box tests test the BDB cluster where the test retains the knowledge of the
* individual test nodes. It uses this knowledge to examine the nodes to ensure that they
@@ -103,7 +100,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
final Connection initialConnection = getConnectionToNodeInCluster();
assertNotNull(initialConnection);
- killConnectionBroker(initialConnection);
+ closeConnectionAndKillBroker(initialConnection);
final Connection subsequentConnection = getConnectionToNodeInCluster();
assertNotNull(subsequentConnection);
@@ -119,7 +116,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
final Connection initialConnection = getConnectionToNodeInCluster();
assertNotNull(initialConnection);
- killConnectionBroker(initialConnection);
+ closeConnectionAndKillBroker(initialConnection);
final Connection subsequentConnection = getConnectionToNodeInCluster();
assertNotNull(subsequentConnection);
@@ -139,6 +136,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
assertNotNull(connection);
final int brokerPortNumber = _clusterCreator.getBrokerPortNumberFromConnection(connection);
+ connection.close();
_clusterCreator.stopNode(brokerPortNumber);
_clusterCreator.startNode(brokerPortNumber);
@@ -157,7 +155,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
populateBrokerWithData(initialConnection, inbuiltExchangeQueueUrl, customExchangeQueueUrl);
- killConnectionBroker(initialConnection);
+ closeConnectionAndKillBroker(initialConnection);
final Connection subsequentConnection = getConnectionToNodeInCluster();
@@ -229,10 +227,11 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
return connection;
}
- private void killConnectionBroker(final Connection initialConnection) throws IOException,
- InterruptedException
+ private void closeConnectionAndKillBroker(final Connection initialConnection) throws Exception
{
final int initialPortNumber = _clusterCreator.getBrokerPortNumberFromConnection(initialConnection);
+ initialConnection.close();
+
killBroker(initialPortNumber); // kill awaits the death of the child
}