svn commit: r476169 - in /jakarta/jcs/trunk/src: test-conf/thread_pool.properties test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java

[email protected]
Newsgroups gmane.comp.jakarta.turbine.jcs.devel
Message-ID <[email protected]>
Author: asmuts
Date: Fri Nov 17 07:08:24 2006
New Revision: 476169

URL: http://svn.apache.org/viewvc?view=rev&rev=476169
Log:
Fixing stupid error in the thread pool manager.  If you specify the useBoundary value, it would alwasy be false.  If you didn't then it would be true!

JCS-14

Modified:
    jakarta/jcs/trunk/src/test-conf/thread_pool.properties
    jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java

Modified: jakarta/jcs/trunk/src/test-conf/thread_pool.properties
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test-conf/thread_pool.properties?view=diff&rev=476169&r1=476168&r2=476169
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/thread_pool.properties (original)
+++ jakarta/jcs/trunk/src/test-conf/thread_pool.properties Fri Nov 17 07:08:24 2006
@@ -36,6 +36,16 @@
 thread_pool.waittest.whenBlockedPolicy=WAIT
 thread_pool.waittest.startUpSize=1
 
+# with boundary test thread pool config
+thread_pool.withbound.useBoundary=true
+thread_pool.withbound.boundarySize=1000
+thread_pool.withbound.maximumPoolSize=11
+thread_pool.withbound.minimumPoolSize=1
+thread_pool.withbound.keepAliveTime=1
+thread_pool.withbound.whenBlockedPolicy=WAIT
+thread_pool.withbound.startUpSize=1
+
+
 # no boundary test thread pool config
 thread_pool.nobound.useBoundary=false
 thread_pool.nobound.boundarySize=1000

Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java?view=diff&rev=476169&r1=476168&r2=476169
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolManagerUnitTest.java Fri Nov 17 07:08:24 2006
@@ -6,6 +6,7 @@
 
 import org.apache.jcs.utils.props.PropertyLoader;
 
+import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
 import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
 
 /**
@@ -159,6 +160,23 @@
         assertNotNull( "Should have gotten back a pool.", pool );
 
         assertTrue( "Should have a linked queue and not a bounded buffer.", pool.getQueue() instanceof LinkedQueue );
-
     }
+    
+    /**
+     * Verify that if we specify useBoundary=true that we get a BoundedBuffer.
+     *
+     */
+    public void testWithBoundary()
+    {
+        ThreadPoolManager.setPropsFileName( "thread_pool.properties" );
+        ThreadPoolManager mgr = ThreadPoolManager.getInstance();
+        // force config from new props file
+        mgr.configure();
+        assertNotNull( mgr );
+
+        ThreadPool pool = mgr.getPool( "withbound" );
+        assertNotNull( "Should have gotten back a pool.", pool );
+
+        assertTrue( "Should have a BoundedBuffer and not a linked queue.", pool.getQueue() instanceof BoundedBuffer );
+    }    
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.