[jboss-cvs] JBossAS SVN: r74337 - trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jun 10 04:20:24 EDT 2008
Author: jesper.pedersen
Date: 2008-06-10 04:20:24 -0400 (Tue, 10 Jun 2008)
New Revision: 74337
Modified:
trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/MySQLValidConnectionChecker.java
Log:
[JBAS-5612] MySQLValidConnectionChecker is not serializable
Modified: trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/MySQLValidConnectionChecker.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/MySQLValidConnectionChecker.java 2008-06-10 08:17:26 UTC (rev 74336)
+++ trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/MySQLValidConnectionChecker.java 2008-06-10 08:20:24 UTC (rev 74337)
@@ -45,24 +45,21 @@
public class MySQLValidConnectionChecker implements ValidConnectionChecker, Serializable {
- private static final Logger log = Logger.getLogger(MySQLValidConnectionChecker.class);
+ private static final Logger log = Logger.getLogger(MySQLValidConnectionChecker.class);
- private static final long serialVersionUID = -2227528634302168878L;
+ //private static final long serialVersionUID = -2227528634302168878L;
- private Method ping;
-
- private boolean driverHasPingMethod = false;
-
- // The timeout (apparently the timeout is ignored?)
- private static Object[] params = new Object[] {};
-
- public MySQLValidConnectionChecker()
+ private boolean driverHasPingMethod = false;
+
+ // The timeout (apparently the timeout is ignored?)
+ private static Object[] params = new Object[] {};
+
+ public MySQLValidConnectionChecker()
{
try
{
Class mysqlConnection = Thread.currentThread().getContextClassLoader().loadClass("com.mysql.jdbc.Connection");
- ping = mysqlConnection.getMethod("ping", new Class[]
- {});
+ Method ping = mysqlConnection.getMethod("ping", new Class[] {});
if (ping != null)
{
driverHasPingMethod = true;
@@ -74,13 +71,15 @@
}
}
- public SQLException isValidConnection(Connection c)
+ public SQLException isValidConnection(Connection c)
{
//if there is a ping method then use it, otherwise just use a 'SELECT 1' statement
if (driverHasPingMethod)
{
try
{
+ Class mysqlConnection = Thread.currentThread().getContextClassLoader().loadClass("com.mysql.jdbc.Connection");
+ Method ping = mysqlConnection.getMethod("ping", new Class[] {});
ping.invoke(c, params);
}
catch (Exception e)
@@ -95,7 +94,6 @@
return new SQLException("ping failed: " + e.toString());
}
}
-
}
else
{
More information about the jboss-cvs-commits
mailing list