Added:
trunk/src/com/mysql/jdbc/BalanceStrategy.java
trunk/src/com/mysql/jdbc/BestResponseTimeBalanceStrategy.java
trunk/src/com/mysql/jdbc/RandomBalanceStrategy.java
Modified:
trunk/
trunk/CHANGES
trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
trunk/src/testsuite/regression/ConnectionRegressionTest.java
Log:
Merged revisions
6585-6586,6593-6597,6599-6602,6605,6607-6609,6612,6614-6617,6619-6620,6623-6627,6632,6636-6638,6641,6649,6658-6659,6663,6665-6673,6676,6681-6682,6684,6686,6688-6689
via svnmerge from
svn+ssh://mmatthews@stripped/connectors-svnroot/connector-j/branches/branch_5_1
.......
r6689 | mmatthews | 2007-11-30 13:30:04 -0600 (Fri, 30 Nov 2007) | 11 lines
Fixed BUG#32877 - Load balancing connection using best response time would incorrectly
"stick" to hosts that were down when the connection was first created.
We solve this problem with a black list that is used during the picking of new hosts.
If the black list ends up including all configured hosts, the driver will retry for
a configurable number of times (the "retriesAllDown" configuration property, with a
default
of 120 times), sleeping 250ms between attempts to pick a new connection.
We've also went ahead and made the balancing strategy extensible. To create a new
strategy,
implement the interface com.mysql.jdbc.BalanceStrategy (which also includes our standard
"extension" interface), and tell the driver to use it by passing in the
class name via the "loadBalanceStrategy" configuration property.
.......
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
- /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6687
+ /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6689
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2007-11-30 19:30:04 UTC (rev 6689)
+++ trunk/CHANGES 2007-12-04 16:15:49 UTC (rev 6690)
@@ -68,6 +68,19 @@
in trunk and beyond it will be "false" (i.e. the old date/time handling code, warts
and all will be deprecated).
+ - Fixed BUG#32877 - Load balancing connection using best response time would
incorrectly
+ "stick" to hosts that were down when the connection was first created.
+
+ We solve this problem with a black list that is used during the picking of new
hosts.
+ If the black list ends up including all configured hosts, the driver will retry for
+ a configurable number of times (the "retriesAllDown" configuration property, with a
default
+ of 120 times), sleeping 250ms between attempts to pick a new connection.
+
+ We've also went ahead and made the balancing strategy extensible. To create a new
strategy,
+ implement the interface com.mysql.jdbc.BalanceStrategy (which also includes our
standard
+ "extension" interface), and tell the driver to use it by passing in the
+ class name via the "loadBalanceStrategy" configuration property.
+
10-09-07 - Version 5.1.5
- Released instead of 5.1.4 to pickup patch for BUG#31053
Copied: trunk/src/com/mysql/jdbc/BalanceStrategy.java (from rev 6689,
branches/branch_5_1/src/com/mysql/jdbc/BalanceStrategy.java)
===================================================================
--- trunk/src/com/mysql/jdbc/BalanceStrategy.java (rev 0)
+++ trunk/src/com/mysql/jdbc/BalanceStrategy.java 2007-12-04 16:15:49 UTC (rev 6690)
@@ -0,0 +1,77 @@
+/*
+ Copyright (C) 2007 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ There are special exceptions to the terms and conditions of the GPL
+ as it is applied to this software. View the full text of the
+ exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
+ software distribution.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ */
+package com.mysql.jdbc;
+
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Implement this interface to provide a new load balancing strategy for URLs of
+ * the form "jdbc:mysql:loadbalance://..", and provide the implementation class
+ * name as the configuration parameter "loadBalanceStrategy".
+ *
+ * The driver will not pass in a Connection instance when calling init(), but it
+ * will pass in the Properties, otherwise it acts like a normal Extension.
+ *
+ * One instance of a strategy *per* JDBC connection instance will be created. If
+ * you need singleton-like behavior, you're on your own to provide it.
+ */
+public interface BalanceStrategy extends Extension {
+ /**
+ * Called by the driver to pick a new connection to route requests over.
+ *
+ * @param proxy
+ * the InvocationHandler that deals with actual method calls to
+ * the JDBC connection, and serves as a factory for new
+ * connections for this strategy via the
+ * createConnectionForHost() method.
+ *
+ * This proxy takes care of maintaining the response time list, map of
+ * host/ports to live connections, and taking connections out of the live
+ * connections map if they receive a network-related error while they are in
+ * use by the application.
+ * @param configuredHosts
+ * the list of hosts/ports (in "host:port" form) as passed in by
+ * the user.
+ * @param liveConnections
+ * a map of host/ports to "live" connections to them.
+ * @param responseTimes
+ * the list of response times for a <strong>transaction</strong>
+ * for each host in the configured hosts list.
+ * @param numRetries
+ * the number of times the driver expects this strategy to re-try
+ * connection attempts if creating a new connection fails.
+ * @return the physical JDBC connection for the application to use, based
+ * upon the strategy employed.
+ * @throws SQLException
+ * if a new connection can not be found or created by this
+ * strategy.
+ *
+ * @see LoadBalancingConnectionProxy#createConnectionForHost(String)
+ */
+ public abstract Connection pickConnection(
+ LoadBalancingConnectionProxy proxy, List configuredHosts,
+ Map liveConnections, long[] responseTimes, int numRetries)
+ throws SQLException;
+}
\ No newline at end of file
Copied: trunk/src/com/mysql/jdbc/BestResponseTimeBalanceStrategy.java (from rev 6689,
branches/branch_5_1/src/com/mysql/jdbc/BestResponseTimeBalanceStrategy.java)
===================================================================
--- trunk/src/com/mysql/jdbc/BestResponseTimeBalanceStrategy.java
(rev 0)
+++ trunk/src/com/mysql/jdbc/BestResponseTimeBalanceStrategy.java 2007-12-04 16:15:49 UTC
(rev 6690)
@@ -0,0 +1,119 @@
+/*
+ Copyright (C) 2007 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ There are special exceptions to the terms and conditions of the GPL
+ as it is applied to this software. View the full text of the
+ exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
+ software distribution.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ */
+package com.mysql.jdbc;
+
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class BestResponseTimeBalanceStrategy implements BalanceStrategy {
+
+ /**
+ * @param loadBalancingConnectionProxy
+ */
+ public BestResponseTimeBalanceStrategy() {
+ }
+
+ public void destroy() {
+ // we don't have anything to clean up
+ }
+
+ public void init(Connection conn, Properties props) throws SQLException {
+ // we don't have anything to initialize
+ }
+
+ public Connection pickConnection(LoadBalancingConnectionProxy proxy,
+ List configuredHosts, Map liveConnections, long[] responseTimes,
+ int numRetries) throws SQLException {
+ long minResponseTime = Long.MAX_VALUE;
+
+ int bestHostIndex = 0;
+
+ Map blackList = new HashMap(configuredHosts.size());
+
+ SQLException ex = null;
+
+ for (int attempts = 0; attempts < numRetries; attempts++) {
+ // safety
+ if (blackList.size() == configuredHosts.size()) {
+ blackList.clear();
+ }
+
+ for (int i = 0; i < responseTimes.length; i++) {
+ long candidateResponseTime = responseTimes[i];
+
+ if (candidateResponseTime < minResponseTime
+ && !blackList.containsKey(configuredHosts.get(i))) {
+ if (candidateResponseTime == 0) {
+ bestHostIndex = i;
+
+ break;
+ }
+
+ bestHostIndex = i;
+ minResponseTime = candidateResponseTime;
+ }
+ }
+
+ String bestHost = (String) configuredHosts.get(bestHostIndex);
+
+ Connection conn = (Connection) liveConnections.get(bestHost);
+
+ if (conn == null) {
+ try {
+ conn = proxy.createConnectionForHost(bestHost);
+ } catch (SQLException sqlEx) {
+ ex = sqlEx;
+
+ if (sqlEx instanceof CommunicationsException
+ || "08S01".equals(sqlEx.getSQLState())) {
+ blackList.put(bestHost, null);
+
+ if (blackList.size() == configuredHosts.size()) {
+ blackList.clear(); // try again after a little bit
+
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ continue;
+ } else {
+ throw sqlEx;
+ }
+ }
+ }
+
+ return conn;
+ }
+
+ if (ex != null) {
+ throw ex;
+ }
+
+ return null; // we won't get here, compiler can't tell
+ }
+}
\ No newline at end of file
Modified: trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
===================================================================
--- trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java 2007-11-30 19:30:04 UTC
(rev 6689)
+++ trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java 2007-12-04 16:15:49 UTC
(rev 6690)
@@ -28,6 +28,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.SQLException;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -69,87 +70,6 @@
}
}
- interface BalanceStrategy {
- abstract Connection pickConnection() throws SQLException;
- }
-
- class BestResponseTimeBalanceStrategy implements BalanceStrategy {
-
- public Connection pickConnection() throws SQLException {
- long minResponseTime = Long.MAX_VALUE;
-
- int bestHostIndex = 0;
-
- long[] localResponseTimes = new long[responseTimes.length];
-
- synchronized (responseTimes) {
- System.arraycopy(responseTimes, 0, localResponseTimes, 0, responseTimes.length);
- }
-
- SQLException ex = null;
-
- for (int attempts = 0; attempts < 1200 /* 5 minutes */; attempts++) {
- for (int i = 0; i < localResponseTimes.length; i++) {
- long candidateResponseTime = localResponseTimes[i];
-
- if (candidateResponseTime < minResponseTime) {
- if (candidateResponseTime == 0) {
- bestHostIndex = i;
-
- break;
- }
-
- bestHostIndex = i;
- minResponseTime = candidateResponseTime;
- }
- }
-
- if (bestHostIndex == localResponseTimes.length - 1) {
- // try again, assuming that the previous list was mostly
- // correct as far as distribution of response times went
-
- synchronized (responseTimes) {
- System.arraycopy(responseTimes, 0, localResponseTimes, 0, responseTimes.length);
- }
-
- continue;
- }
- String bestHost = (String) hostList.get(bestHostIndex);
-
- Connection conn = (Connection) liveConnections.get(bestHost);
-
- if (conn == null) {
- try {
- conn = createConnectionForHost(bestHost);
- } catch (SQLException sqlEx) {
- ex = sqlEx;
-
- if (sqlEx instanceof CommunicationsException ||
"08S01".equals(sqlEx.getSQLState())) {
- localResponseTimes[bestHostIndex] = Long.MAX_VALUE;
-
- try {
- Thread.sleep(250);
- } catch (InterruptedException e) {
- }
-
- continue;
- } else {
- throw sqlEx;
- }
- }
- }
-
- return conn;
- }
-
- if (ex != null) {
- throw ex;
- }
-
- return null; // we won't get here, compiler can't tell
- }
- }
-
// Lifted from C/J 5.1's JDBC-2.0 connection pool classes, let's merge this
// if/when this gets into 5.1
protected class ConnectionErrorFiringInvocationHandler implements
@@ -178,55 +98,6 @@
}
}
- class RandomBalanceStrategy implements BalanceStrategy {
-
- public Connection pickConnection() throws SQLException {
-
- SQLException ex = null;
-
- for (int attempts = 0; attempts < 1200 /* 5 minutes */; attempts++) {
- int random = (int) (Math.random() * hostList.size());
-
- if (random == hostList.size()) {
- random--;
- }
-
- String hostPortSpec = (String) hostList.get(random);
-
- Connection conn = (Connection) liveConnections.get(hostPortSpec);
-
- if (conn == null) {
- try {
- conn = createConnectionForHost(hostPortSpec);
- } catch (SQLException sqlEx) {
- ex = sqlEx;
-
- if (sqlEx instanceof CommunicationsException ||
"08S01".equals(sqlEx.getSQLState())) {
-
- try {
- Thread.sleep(250);
- } catch (InterruptedException e) {
- }
-
- continue;
- } else {
- throw sqlEx;
- }
- }
- }
-
- return conn;
- }
-
- if (ex != null) {
- throw ex;
- }
-
- return null; // we won't get here, compiler can't tell
- }
-
- }
-
private Connection currentConn;
private List hostList;
@@ -239,16 +110,18 @@
private Map hostsToListIndexMap;
- boolean inTransaction = false;
+ private boolean inTransaction = false;
- long transactionStartTime = 0;
+ private long transactionStartTime = 0;
- Properties localProps;
+ private Properties localProps;
- boolean isClosed = false;
+ private boolean isClosed = false;
- BalanceStrategy balancer;
+ private BalanceStrategy balancer;
+ private int retriesAllDown;
+
/**
* Creates a proxy for java.sql.Connection that routes requests between the
* given list of host:port and uses the given properties when creating
@@ -281,16 +154,32 @@
String strategy = this.localProps.getProperty("loadBalanceStrategy",
"random");
+ String retriesAllDownAsString = this.localProps.getProperty("retriesAllDown", "120");
+
+ try {
+ this.retriesAllDown = Integer.parseInt(retriesAllDownAsString);
+ } catch (NumberFormatException nfe) {
+ throw SQLError.createSQLException(Messages.getString(
+ "LoadBalancingConnectionProxy.badValueForRetriesAllDown",
+ new Object[] { retriesAllDownAsString }),
+ SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+ }
+
if ("random".equals(strategy)) {
- this.balancer = new RandomBalanceStrategy();
+ this.balancer = (BalanceStrategy) Util.loadExtensions(null, props,
+ "com.mysql.jdbc.RandomBalanceStrategy",
+ "InvalidLoadBalanceStrategy").get(0);
} else if ("bestResponseTime".equals(strategy)) {
- this.balancer = new BestResponseTimeBalanceStrategy();
+ this.balancer = (BalanceStrategy) Util.loadExtensions(null, props,
+ "com.mysql.jdbc.BestResponseTimeBalanceStrategy",
+ "InvalidLoadBalanceStrategy").get(0);
} else {
- throw SQLError.createSQLException(Messages.getString(
- "InvalidLoadBalanceStrategy", new Object[] { strategy }),
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+ this.balancer = (BalanceStrategy) Util.loadExtensions(null, props,
+ strategy, "InvalidLoadBalanceStrategy").get(0);
}
+ this.balancer.init(null, props);
+
pickNewConnection();
}
@@ -302,7 +191,7 @@
* @return
* @throws SQLException
*/
- private synchronized Connection createConnectionForHost(String hostPortSpec)
+ public synchronized Connection createConnectionForHost(String hostPortSpec)
throws SQLException {
Properties connProps = (Properties) this.localProps.clone();
@@ -396,6 +285,10 @@
((Connection) allConnections.next()).close();
}
+ if (!this.isClosed) {
+ this.balancer.destroy();
+ }
+
this.liveConnections.clear();
this.connectionsToHostsMap.clear();
}
@@ -461,12 +354,20 @@
*/
private synchronized void pickNewConnection() throws SQLException {
if (this.currentConn == null) {
- this.currentConn = this.balancer.pickConnection();
+ this.currentConn = this.balancer.pickConnection(this,
+ Collections.unmodifiableList(this.hostList),
+ Collections.unmodifiableMap(this.liveConnections),
+ (long[]) this.responseTimes.clone(),
+ this.retriesAllDown);
return;
}
- Connection newConn = this.balancer.pickConnection();
+ Connection newConn = this.balancer.pickConnection(this,
+ Collections.unmodifiableList(this.hostList),
+ Collections.unmodifiableMap(this.liveConnections),
+ (long[]) this.responseTimes.clone(),
+ this.retriesAllDown);
newConn.setTransactionIsolation(this.currentConn
.getTransactionIsolation());
Copied: trunk/src/com/mysql/jdbc/RandomBalanceStrategy.java (from rev 6689,
branches/branch_5_1/src/com/mysql/jdbc/RandomBalanceStrategy.java)
===================================================================
--- trunk/src/com/mysql/jdbc/RandomBalanceStrategy.java (rev 0)
+++ trunk/src/com/mysql/jdbc/RandomBalanceStrategy.java 2007-12-04 16:15:49 UTC (rev 6690)
@@ -0,0 +1,115 @@
+/*
+ Copyright (C) 2007 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ There are special exceptions to the terms and conditions of the GPL
+ as it is applied to this software. View the full text of the
+ exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
+ software distribution.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ */
+package com.mysql.jdbc;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class RandomBalanceStrategy implements BalanceStrategy {
+
+ public RandomBalanceStrategy() {
+ }
+
+ public void destroy() {
+ // we don't have anything to clean up
+ }
+
+ public void init(Connection conn, Properties props) throws SQLException {
+ // we don't have anything to initialize
+ }
+
+ public Connection pickConnection(LoadBalancingConnectionProxy proxy,
+ List configuredHosts, Map liveConnections, long[] responseTimes,
+ int numRetries) throws SQLException {
+ int numHosts = configuredHosts.size();
+
+ SQLException ex = null;
+
+ Map whiteListMap = new HashMap(numHosts);
+ List whiteList = new ArrayList(numHosts);
+ whiteList.addAll(configuredHosts);
+
+ for (int i = 0; i < numHosts; i++) {
+ whiteListMap.put(whiteList.get(i), new Integer(i));
+ }
+
+ for (int attempts = 0; attempts < numRetries; attempts++) {
+ int random = (int) (Math.random() * whiteList.size());
+
+ if (random == whiteList.size()) {
+ random--;
+ }
+
+ String hostPortSpec = (String) whiteList.get(random);
+
+ Connection conn = (Connection) liveConnections.get(hostPortSpec);
+
+ if (conn == null) {
+ try {
+ conn = proxy.createConnectionForHost(hostPortSpec);
+ } catch (SQLException sqlEx) {
+ ex = sqlEx;
+
+ if (sqlEx instanceof CommunicationsException
+ || "08S01".equals(sqlEx.getSQLState())) {
+
+ Integer whiteListIndex = (Integer) whiteListMap
+ .get(hostPortSpec);
+
+ // exclude this host from being picked again
+ if (whiteListIndex != null) {
+ whiteList.remove(whiteListIndex.intValue());
+ }
+
+ if (whiteList.size() == 0) {
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ }
+
+ // start fresh
+ whiteList.addAll(configuredHosts);
+ }
+
+ continue;
+ } else {
+ throw sqlEx;
+ }
+ }
+ }
+
+ return conn;
+ }
+
+ if (ex != null) {
+ throw ex;
+ }
+
+ return null; // we won't get here, compiler can't tell
+ }
+
+}
\ No newline at end of file
Modified: trunk/src/testsuite/regression/ConnectionRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/ConnectionRegressionTest.java 2007-11-30 19:30:04 UTC
(rev 6689)
+++ trunk/src/testsuite/regression/ConnectionRegressionTest.java 2007-12-04 16:15:49 UTC
(rev 6690)
@@ -2174,33 +2174,49 @@
lbConn.close();
}
- private Connection getLoadBalancedConnection(String secondHost, Properties props) throws
SQLException {
+ private Connection getLoadBalancedConnection(int badHostLocation,
+ String badHost, Properties props) throws SQLException {
int indexOfHostStart = dbUrl.indexOf("://") + 3;
int indexOfHostEnd = dbUrl.indexOf("/", indexOfHostStart);
- String backHalf = dbUrl.substring(indexOfHostStart, indexOfHostEnd);
+ String firstHost = dbUrl.substring(indexOfHostStart, indexOfHostEnd);
- if (backHalf.length() == 0) {
- backHalf = "localhost:3306";
+ if (firstHost.length() == 0) {
+ firstHost = "localhost:3306";
}
String dbAndConfigs = dbUrl.substring(indexOfHostEnd);
- if (secondHost != null) {
- secondHost = secondHost + ",";
+ if (badHost != null) {
+ badHost = badHost + ",";
}
- Connection lbConn = DriverManager.getConnection("jdbc:mysql:loadbalance://" +
backHalf + "," + secondHost + backHalf + dbAndConfigs, props);
+ String hostsString = null;
+
+ switch (badHostLocation) {
+ case 1:
+ hostsString = badHost + firstHost;
+ break;
+ case 2:
+ hostsString = firstHost + badHost + firstHost;
+ break;
+ case 3:
+ hostsString = firstHost + "," + badHost;
+ default:
+ throw new IllegalArgumentException();
+ }
+
+ Connection lbConn = DriverManager.getConnection("jdbc:mysql:loadbalance://" +
hostsString + dbAndConfigs, props);
return lbConn;
}
private Connection getLoadBalancedConnection() throws SQLException {
- return getLoadBalancedConnection("", null);
+ return getLoadBalancedConnection(1, "", null);
}
private Connection getLoadBalancedConnection(Properties props) throws SQLException {
- return getLoadBalancedConnection("", props);
+ return getLoadBalancedConnection(1, "", props);
}
@@ -2276,7 +2292,7 @@
props.setProperty("connectTimeout", "2000");
props.setProperty("loadBalanceStrategy", "random");
- Connection lbConn = getLoadBalancedConnection("localhost:23", props);
+ Connection lbConn = getLoadBalancedConnection(2, "localhost:23", props);
lbConn.setAutoCommit(false);
@@ -2284,4 +2300,22 @@
lbConn.commit();
}
}
+
+ public void testBug32877() throws Exception {
+ Properties props = new Properties();
+ props.setProperty("connectTimeout", "2000");
+ props.setProperty("loadBalanceStrategy", "bestResponseTime");
+
+ Connection lbConn = getLoadBalancedConnection(1, "localhost:23", props);
+
+ lbConn.setAutoCommit(false);
+
+ long begin = System.currentTimeMillis();
+
+ for (int i = 0; i < 4; i++) {
+ lbConn.commit();
+ }
+
+ assertTrue(System.currentTimeMillis() - begin < 10000);
+ }
}
| Thread |
|---|
| • Connector/J commit: r6690 - in trunk: . src/com/mysql/jdbc src/testsuite/regression | mmatthews | 4 Dec |