cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkazimirc...@apache.org
Subject svn commit: r1181763 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
Date Tue, 11 Oct 2011 12:59:15 GMT
Author: dkazimirchyk
Date: Tue Oct 11 12:59:14 2011
New Revision: 1181763

URL: http://svn.apache.org/viewvc?rev=1181763&view=rev
Log:
CAY-1513 Deadlock in PoolManager

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java?rev=1181763&r1=1181762&r2=1181763&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
Tue Oct 11 12:59:14 2011
@@ -187,7 +187,7 @@ public class PoolManager implements Data
      * @since 3.1
      */
     @BeforeScopeEnd
-    public void shutdown() throws SQLException {
+    public synchronized void shutdown() throws SQLException {
         
         // disposing maintenance thread first to avoid any changes to pools
         // during shutdown
@@ -544,14 +544,14 @@ public class PoolManager implements Data
                     // ignore...
                 }
 
-                if (shouldDie) {
-                    break;
-                }
-
                 synchronized (pool) {
                     // TODO: implement a smarter algorithm for pool management...
                     // right now it will simply close one connection if the count is
                     // above median and there are any idle connections.
+                    
+                    if (shouldDie) {
+                        break;
+                    }
 
                     int unused = pool.getCurrentlyUnused();
                     int used = pool.getCurrentlyInUse();



Mime
View raw message