You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2009/12/21 18:15:41 UTC
svn commit: r892887 -
/tomcat/trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java
Author: markt
Date: Mon Dec 21 17:15:41 2009
New Revision: 892887
URL: http://svn.apache.org/viewvc?rev=892887&view=rev
Log:
Only unload JDBC drivers this web app loaded.
Modified:
tomcat/trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java
Modified: tomcat/trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java?rev=892887&r1=892886&r2=892887&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/JdbcLeakPrevention.java Mon Dec 21 17:15:41 2009
@@ -38,23 +38,16 @@
*/
public class JdbcLeakPrevention {
- /*
- * This driver is visible to all classloaders but is loaded by the system
- * class loader so there is no need to unload it.
- */
- private static final String JDBC_ODBC_BRIDGE_DRIVER =
- "sun.jdbc.odbc.JdbcOdbcDriver";
-
public List<String> clearJdbcDriverRegistrations() throws SQLException {
List<String> driverNames = new ArrayList<String>();
-
- // Unregister any JDBC drivers loaded by the class loader that loaded
- // this class - ie the webapp class loader
+
+ // This will list all drivers visible to this class loader
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
- if (JDBC_ODBC_BRIDGE_DRIVER.equals(
- driver.getClass().getCanonicalName())) {
+ // Only unload the drivers this web app loaded
+ if (driver.getClass().getClassLoader() !=
+ this.getClass().getClassLoader()) {
continue;
}
driverNames.add(driver.getClass().getCanonicalName());
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org