directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r385269 - /directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java
Date Sun, 12 Mar 2006 09:44:19 GMT
Author: trustin
Date: Sun Mar 12 01:44:17 2006
New Revision: 385269

URL: http://svn.apache.org/viewcvs?rev=385269&view=rev
Log:
Fixed a problem that a thread pool is shared among different services

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java?rev=385269&r1=385268&r2=385269&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java
Sun Mar 12 01:44:17 2006
@@ -15,9 +15,10 @@
     public static final int DEFAULT_KEEP_ALIVE_TIME = ThreadPoolFilter.DEFAULT_KEEP_ALIVE_TIME;
     
     private static int id = 1;
+    private String threadNamePrefix;
+    private int keepAliveTime;
+    private int maximumPoolSize;
 
-    private final ThreadPoolFilter filter;
-    
     public PooledThreadModel()
     {
         this( "AnonymousIoService-" + id++, DEFAULT_MAXIMUM_POOL_SIZE );
@@ -30,48 +31,45 @@
 
     public PooledThreadModel( String threadNamePrefix, int maxThreads )
     {
-        filter = new ThreadPoolFilter();
         setMaximumPoolSize( maxThreads );
         setThreadNamePrefix( threadNamePrefix );
     }
 
     public String getThreadNamePrefix()
     {
-        return filter.getThreadNamePrefix();
+        return threadNamePrefix;
     }
 
     public void setThreadNamePrefix( String threadNamePrefix )
     {
-        filter.setThreadNamePrefix( threadNamePrefix );
+        this.threadNamePrefix = threadNamePrefix;
     }
     
-    public int getPoolSize()
-    {
-        return filter.getPoolSize();
-    }
-
     public int getMaximumPoolSize()
     {
-        return filter.getMaximumPoolSize();
+        return maximumPoolSize;
     }
 
     public int getKeepAliveTime()
     {
-        return filter.getKeepAliveTime();
+        return keepAliveTime;
     }
 
     public void setMaximumPoolSize( int maximumPoolSize )
     {
-        filter.setMaximumPoolSize( maximumPoolSize );
+        this.maximumPoolSize = maximumPoolSize;
     }
 
     public void setKeepAliveTime( int keepAliveTime )
     {
-        filter.setKeepAliveTime( keepAliveTime );
+        this.keepAliveTime = keepAliveTime;
     }
 
     public void buildFilterChain( IoFilterChain chain ) throws Exception
     {
+        ThreadPoolFilter filter = new ThreadPoolFilter( threadNamePrefix );
+        filter.setKeepAliveTime( keepAliveTime );
+        filter.setMaximumPoolSize( maximumPoolSize );
         chain.addFirst( PooledThreadModel.class.getName(), filter );
     }
 }



Mime
View raw message