db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r631258 - in /db/derby/code/trunk/java/client/org/apache/derby/client/am: CachingLogicalConnection.java CachingLogicalConnection40.java
Date Tue, 26 Feb 2008 15:49:06 GMT
Author: kristwaa
Date: Tue Feb 26 07:49:05 2008
New Revision: 631258

URL: http://svn.apache.org/viewvc?rev=631258&view=rev
Log:
DERBY-3326: Introduce a caching logical connection and logical prepared statement in the client
driver.
Fixed an obvious NPE I overlooked, and also synchronized the close method in CachingLogicalConnection[40].
Patch file: derby-3326-6b-npe_fix_synch_CLC.diff

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection40.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection.java?rev=631258&r1=631257&r2=631258&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection.java
(original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection.java
Tue Feb 26 07:49:05 2008
@@ -64,12 +64,14 @@
                 new StatementCacheInteractor(stmtCache, physicalConnection);
     }
 
-    public void close()
+    public synchronized void close()
             throws SQLException {
-        // Nullify reference to cache interactor to allow it to be GC'ed.
-        // It should not be used again when the logical connection is closed.
-        this.cacheInteractor = null;
-        super.close();
+        if (this.cacheInteractor != null) {
+            // Nullify reference to cache interactor to allow it to be GC'ed.
+            // It should not be used again when, logical connection is closed.
+            this.cacheInteractor = null;
+            super.close();
+        }
     }
 
     public synchronized PreparedStatement prepareStatement(String sql)

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection40.java?rev=631258&r1=631257&r2=631258&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection40.java
(original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CachingLogicalConnection40.java
Tue Feb 26 07:49:05 2008
@@ -59,12 +59,14 @@
                 new StatementCacheInteractor(stmtCache, physicalConnection);
     }
 
-    public void close()
+    public synchronized void close()
             throws SQLException {
-        // Nullify reference to cache interactor to allow it to be GC'ed.
-        // It should not be used again when the logical connection is closed.
-        this.cacheInteractor = null;
-        super.close();
+        if (this.cacheInteractor != null) {
+            // Nullify reference to cache interactor to allow it to be GC'ed.
+            // It should not be used again, the logical connection is closed.
+            this.cacheInteractor = null;
+            super.close();
+        }
     }
 
     public synchronized PreparedStatement prepareStatement(String sql)



Mime
View raw message