summaryrefslogtreecommitdiff
path: root/java
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
commitb19e87903ef322b50ebddc9140decba0898b9f4e (patch)
treea81b4003f4ba5a1d7857b1dba8b6b58c0a02232b /java
parentd19098811db81b4abe0ed5bb247da08a64d2aa17 (diff)
downloadqpid-python-b19e87903ef322b50ebddc9140decba0898b9f4e.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/qpid@1354912 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java b/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
index 88f79e8823..408643b98a 100644
--- a/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
+++ b/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
}