directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r349973 - /directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
Date Wed, 30 Nov 2005 16:13:08 GMT
Author: trustin
Date: Wed Nov 30 08:13:03 2005
New Revision: 349973

URL: http://svn.apache.org/viewcvs?rev=349973&view=rev
Log:
Fixed that ThreadPoolFilter.destroy() jumps into infinite loop.

Modified:
    directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java?rev=349973&r1=349972&r2=349973&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
Wed Nov 30 08:13:03 2005
@@ -672,12 +672,19 @@
         }
 
         shuttingDown = true;
-        while( getPoolSize() != 0 )
+        int expectedPoolSize = 0;
+        while( getPoolSize() != expectedPoolSize )
         {
             List allWorkers;
             synchronized( poolSizeLock )
             {
                 allWorkers = new ArrayList( this.allWorkers );
+            }
+            
+            // You may not interrupt the current thread.
+            if( allWorkers.remove( Thread.currentThread() ) )
+            {
+                expectedPoolSize = 1;
             }
             
             for( Iterator i = allWorkers.iterator(); i.hasNext(); )



Mime
View raw message