commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandy...@apache.org
Subject svn commit: r395102 - in /jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl: GenericKeyedObjectPool.java GenericObjectPool.java SoftReferenceObjectPool.java StackKeyedObjectPool.java StackObjectPool.java
Date Wed, 19 Apr 2006 01:43:58 GMT
Author: sandymac
Date: Tue Apr 18 18:43:56 2006
New Revision: 395102

URL: http://svn.apache.org/viewcvs?rev=395102&view=rev
Log:
The calls to BaseObjectPool.close() and BaseKeyedObjectPool.close() should not
by synchronized. Those methods are implicitly thread-safe and requiring
synchronization while calling them can introduce a high latency while trying to
close a pool when a slow [Keyed]PoolableObjectFactory is being used, eg: one
that does network IO.

Modified:
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java?rev=395102&r1=395101&r2=395102&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
Tue Apr 18 18:43:56 2006
@@ -1160,13 +1160,15 @@
         }
     }
 
-    public synchronized void close() throws Exception {
-        clear();
-        if (null != _evictor) {
-            _evictor.cancel();
-            _evictor = null;
-        }
+    public void close() throws Exception {
         super.close();
+        synchronized (this) {
+            clear();
+            if (null != _evictor) {
+                _evictor.cancel();
+                _evictor = null;
+            }
+        }
     }
 
     public synchronized void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException
{

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=395102&r1=395101&r2=395102&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Tue Apr 18 18:43:56 2006
@@ -971,10 +971,12 @@
         }
     }
 
-    public synchronized void close() throws Exception {
-        clear();
-        startEvictor(-1L);
+    public void close() throws Exception {
         super.close();
+        synchronized (this) {
+            clear();
+            startEvictor(-1L);
+        }
     }
 
     /**

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java?rev=395102&r1=395101&r2=395102&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
Tue Apr 18 18:43:56 2006
@@ -234,9 +234,9 @@
         pruneClearedReferences();
     }
 
-    public synchronized void close() throws Exception {
-        clear();
+    public void close() throws Exception {
         super.close();
+        clear();
     }
 
     /**

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java?rev=395102&r1=395101&r2=395102&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
Tue Apr 18 18:43:56 2006
@@ -401,9 +401,9 @@
      *
      * @throws Exception <strong>deprecated</strong>: implementations should
silently fail if not all resources can be freed.
      */
-    public synchronized void close() throws Exception {
-        clear();
+    public void close() throws Exception {
         super.close();
+        clear();
     }
 
     /**

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java?rev=395102&r1=395101&r2=395102&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
Tue Apr 18 18:43:56 2006
@@ -274,9 +274,9 @@
      *
      * @throws Exception <strong>deprecated</strong>: implementations should
silently fail if not all resources can be freed.
      */
-    public synchronized void close() throws Exception {
-        clear();
+    public void close() throws Exception {
         super.close();
+        clear();
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message