directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik...@apache.org
Subject svn commit: r383673 - /directory/trunks/mina/core/src/main/java/org/apache/mina/filter/ThreadPoolFilter.java
Date Mon, 06 Mar 2006 21:12:20 GMT
Author: niklas
Date: Mon Mar  6 13:12:17 2006
New Revision: 383673

URL: http://svn.apache.org/viewcvs?rev=383673&view=rev
Log:
Changed to way this filter is initialized and destroyed to fix DIRMINA-169. init() was renamed
to start() and destroy() to stop(). 
These methods will not be called by MINA's IoFilter life cycle management. They will have
to be called manually by the user. Alternatively,
start() will be called automatically the first time an instance of this filter is added to
a chain. All Worker threads are now 
set as dameons which means that any workers still alive when the JVM terminates will silently
die.

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/filter/ThreadPoolFilter.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/filter/ThreadPoolFilter.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/filter/ThreadPoolFilter.java?rev=383673&r1=383672&r2=383673&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/filter/ThreadPoolFilter.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/filter/ThreadPoolFilter.java
Mon Mar  6 13:12:17 2006
@@ -28,6 +28,7 @@
 import org.apache.mina.common.CloseFuture;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.IoFilterAdapter;
+import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.util.BlockingQueue;
@@ -170,7 +171,16 @@
         this.keepAliveTime = keepAliveTime;
     }
 
-    public void init()
+    public void onPreAdd( IoFilterChain parent, String name, NextFilter nextFilter ) 
+        throws Exception
+    {
+        if( leader == null )
+        {
+            start();
+        }
+    }
+
+    public void start()
     {
         shuttingDown = false;
         leader = new Worker();
@@ -178,7 +188,7 @@
         leader.lead();
     }
 
-    public void destroy()
+    public void stop()
     {
         shuttingDown = true;
         int expectedPoolSize = 0;
@@ -340,6 +350,7 @@
             this.id = id;
             this.setName( threadNamePrefix + '-' + id );
             increasePoolSize( this );
+            setDaemon( true );
         }
 
         public boolean lead()



Mime
View raw message