Modified:
branches/branch_5_1/CHANGES
branches/branch_5_1/src/com/mysql/jdbc/JDBC4Connection.java
branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java
Log:
Fixed BUG#34703 - Connection.isValid() invalidates connection after
timeout, even if connection is actually valid.
Modified: branches/branch_5_1/CHANGES
===================================================================
--- branches/branch_5_1/CHANGES 2008-02-27 04:52:31 UTC (rev 6738)
+++ branches/branch_5_1/CHANGES 2008-02-27 05:24:07 UTC (rev 6739)
@@ -140,6 +140,9 @@
TIME, DATETIME and TIMESTAMP types when using absolute, relative,
and previous result set navigation methods.
+ - Fixed BUG#34703 - Connection.isValid() invalidates connection after
+ timeout, even if connection is actually valid.
+
10-09-07 - Version 5.1.5
- Released instead of 5.1.4 to pickup patch for BUG#31053
Modified: branches/branch_5_1/src/com/mysql/jdbc/JDBC4Connection.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/JDBC4Connection.java 2008-02-27 04:52:31 UTC
(rev 6738)
+++ branches/branch_5_1/src/com/mysql/jdbc/JDBC4Connection.java 2008-02-27 05:24:07 UTC
(rev 6739)
@@ -96,7 +96,7 @@
TimerTask timeoutTask = null;
if (timeout != 0) {
- getCancelTimer().schedule(new TimerTask() {
+ timeoutTask = new TimerTask() {
public void run() {
new Thread() {
public void run() {
@@ -108,7 +108,9 @@
}
}.start();
}
- }, timeout * 1000);
+ };
+
+ getCancelTimer().schedule(timeoutTask, timeout * 1000);
}
try {
Modified: branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java
===================================================================
--- branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java 2008-02-27
04:52:31 UTC (rev 6738)
+++ branches/branch_5_1/src/testsuite/regression/ConnectionRegressionTest.java 2008-02-27
05:24:07 UTC (rev 6739)
@@ -2334,4 +2334,20 @@
testConn.close();
}
}
+
+ /** 34703 [NEW]: isValild() aborts Connection on timeout */
+
+ public void testBug34703() throws Exception {
+ if (!com.mysql.jdbc.Util.isJdbc4()) {
+ return;
+ }
+
+ Method isValid = java.sql.Connection.class.getMethod("isValid", new Class[]
{Integer.TYPE});
+
+
+ Connection newConn = getConnectionWithProps((Properties)null);
+ isValid.invoke(newConn, new Object[] {new Integer(1)});
+ Thread.sleep(2000);
+ assertTrue(((Boolean)isValid.invoke(newConn, new Object[] {new
Integer(0)})).booleanValue());
+ }
}
\ No newline at end of file
| Thread |
|---|
| • Connector/J commit: r6739 - in branches/branch_5_1: . src/com/mysql/jdbc src/testsuite/regression | mmatthews | 27 Feb 2008 |