geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1164418 - in /geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc: DatabaseDriverExtender.java DelegatingDriver.java
Date Fri, 02 Sep 2011 09:08:25 GMT
Author: xuhaihong
Date: Fri Sep  2 09:08:25 2011
New Revision: 1164418

URL: http://svn.apache.org/viewvc?rev=1164418&view=rev
Log:
GERONIMO-6009 Remove the use of JDBC driver leak prevention bundle listener
The might not work as expected in OSGi environment.

Modified:
    geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DatabaseDriverExtender.java
    geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DelegatingDriver.java

Modified: geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DatabaseDriverExtender.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DatabaseDriverExtender.java?rev=1164418&r1=1164417&r2=1164418&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DatabaseDriverExtender.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DatabaseDriverExtender.java
Fri Sep  2 09:08:25 2011
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URL;
 import java.sql.Driver;
+import java.sql.DriverManager;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -51,15 +52,15 @@ public class DatabaseDriverExtender impl
         tracker = new BundleTracker(context, Bundle.ACTIVE, new DriverBundleTrackerCustomizer());
         tracker.open();
 
-        jdbcPreventionListener = new JdbcLeakPreventionListener();
+        //jdbcPreventionListener = new JdbcLeakPreventionListener();
         context.addBundleListener(jdbcPreventionListener);
     }
 
     public void stop(BundleContext context) throws Exception {
         tracker.close();
-        context.removeBundleListener(jdbcPreventionListener);
+        //context.removeBundleListener(jdbcPreventionListener);
         //Remove any driver from myself
-        JdbcLeakPreventionListener.unRegisterJdbcDrivers(context.getBundle());
+        DriverManager.deregisterDriver(DelegatingDriver.DELEGATINGDRIVER_INSTANCE);
     }
 
     private static List<Driver> loadDrivers(Bundle bundle, URL providerURL) {

Modified: geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DelegatingDriver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DelegatingDriver.java?rev=1164418&r1=1164417&r2=1164418&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DelegatingDriver.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-jdbc/src/main/java/org/apache/geronimo/jdbc/DelegatingDriver.java
Fri Sep  2 09:08:25 2011
@@ -36,10 +36,13 @@ import java.sql.DriverManager;
 public class DelegatingDriver implements Driver {
 
     private static final List<Driver> DRIVERS = new CopyOnWriteArrayList<Driver>();
+    
+    static final DelegatingDriver DELEGATINGDRIVER_INSTANCE; 
 
     static {
         try {
-            DriverManager.registerDriver(new DelegatingDriver());
+            DELEGATINGDRIVER_INSTANCE = new DelegatingDriver();
+            DriverManager.registerDriver(DELEGATINGDRIVER_INSTANCE);
         } catch (SQLException e) {
             throw new RuntimeException(e);
         }



Mime
View raw message