directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r440584 - /directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java
Date Wed, 06 Sep 2006 03:06:14 GMT
Author: trustin
Date: Tue Sep  5 20:06:13 2006
New Revision: 440584

URL: http://svn.apache.org/viewvc?view=rev&rev=440584
Log:
Fixed issue: DIRMINA-251 (PooledThreadModel must allow the application to specify a ThreadPool
implementation)
* Added get/setThreadPool() to PooledThreadModel
* Removed all indirect methods which can be configured via getThreadPool()

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/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/common/PooledThreadModel.java?view=diff&rev=440584&r1=440583&r2=440584
==============================================================================
--- 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
Tue Sep  5 20:06:13 2006
@@ -85,7 +85,7 @@
         return model;
     }
     
-    private final ThreadPoolFilter filter = new ThreadPoolFilter();
+    private ThreadPoolFilter filter = new ThreadPoolFilter();
 
     private PooledThreadModel( String threadNamePrefix )
     {
@@ -94,38 +94,27 @@
 
     private PooledThreadModel( String threadNamePrefix, int maxThreads )
     {
-        setMaximumPoolSize( maxThreads );
-        setThreadNamePrefix( threadNamePrefix );
+        getThreadPool().setMaximumPoolSize( maxThreads );
+        getThreadPool().setThreadNamePrefix( threadNamePrefix );
     }
 
-    public String getThreadNamePrefix()
+    /**
+     * Returns the underlying {@link ThreadPool} of this model.
+     * You can change various properties such as the number of threads
+     * by calling methods of {@link ThreadPool}.
+     */
+    public ThreadPool getThreadPool()
     {
-        return filter.getThreadPool().getThreadNamePrefix();
-    }
-
-    public void setThreadNamePrefix( String threadNamePrefix )
-    {
-        filter.getThreadPool().setThreadNamePrefix( threadNamePrefix );
+        return filter.getThreadPool();
     }
     
-    public int getMaximumPoolSize()
-    {
-        return filter.getThreadPool().getMaximumPoolSize();
-    }
-
-    public int getKeepAliveTime()
-    {
-        return filter.getThreadPool().getKeepAliveTime();
-    }
-
-    public void setMaximumPoolSize( int maximumPoolSize )
-    {
-        filter.getThreadPool().setMaximumPoolSize( maximumPoolSize );
-    }
-
-    public void setKeepAliveTime( int keepAliveTime )
+    /**
+     * Changes the underlying {@link ThreadPool} of this model.
+     * Only newly created {@link IoSession}s will be affected.
+     */
+    public void setThreadPool( ThreadPool threadPool )
     {
-        filter.getThreadPool().setKeepAliveTime( keepAliveTime );
+        filter = new ThreadPoolFilter( threadPool );
     }
 
     public void buildFilterChain( IoFilterChain chain ) throws Exception



Mime
View raw message