Author: robbie Date: Thu Jun 28 11:00:08 2012 New Revision: 1354912 URL: http://svn.apache.org/viewvc?rev=1354912&view=rev Log: 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.
Modified: qpid/trunk/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java Modified: qpid/trunk/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java?rev=1354912&r1=1354911&r2=1354912&view=diff ============================================================================== --- qpid/trunk/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java (original) +++ qpid/trunk/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java Thu Jun 28 11:00:08 2012 @@ -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 exten final Connection initialConnection = getConnectionToNodeInCluster(); assertNotNull(initialConnection); - killConnectionBroker(initialConnection); + closeConnectionAndKillBroker(initialConnection); final Connection subsequentConnection = getConnectionToNodeInCluster(); assertNotNull(subsequentConnection); @@ -119,7 +116,7 @@ public class HAClusterWhiteboxTest exten final Connection initialConnection = getConnectionToNodeInCluster(); assertNotNull(initialConnection); - killConnectionBroker(initialConnection); + closeConnectionAndKillBroker(initialConnection); final Connection subsequentConnection = getConnectionToNodeInCluster(); assertNotNull(subsequentConnection); @@ -139,6 +136,7 @@ public class HAClusterWhiteboxTest exten assertNotNull(connection); final int brokerPortNumber = _clusterCreator.getBrokerPortNumberFromConnection(connection); + connection.close(); _clusterCreator.stopNode(brokerPortNumber); _clusterCreator.startNode(brokerPortNumber); @@ -157,7 +155,7 @@ public class HAClusterWhiteboxTest exten populateBrokerWithData(initialConnection, inbuiltExchangeQueueUrl, customExchangeQueueUrl); - killConnectionBroker(initialConnection); + closeConnectionAndKillBroker(initialConnection); final Connection subsequentConnection = getConnectionToNodeInCluster(); @@ -229,10 +227,11 @@ public class HAClusterWhiteboxTest exten 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 } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org