Hi.
I'm not sure on this patch so I'm not JIRA-ing it (yet). I don't like
seeing any test output when I run the unit tests for a package, and
this one looked like:
[junit] Running org.apache.jcs.utils.threadpool.ThreadPoolUnitTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.524
sec
[junit] count = 19 after sleep current size = 4
[junit] count = 23 before sleep current size = 4
[junit] count = 20 after sleep current size = 4
[junit] count = 24 before sleep current size = 4
[junit] count = 21 after sleep current size = 4
[junit] count = 25 before sleep current size = 4
[junit] count = 25 after sleep current size = 4
[junit] count = 26 before sleep current size = 4
[junit] count = 24 after sleep current size = 4
[junit] count = 27 before sleep current size = 4
[junit] count = 23 after sleep current size = 4
[junit] count = 28 before sleep current size = 4
[junit] count = 22 after sleep current size = 4
[junit] count = 29 before sleep current size = 4
[junit] count = 26 after sleep current size = 4
[junit] count = 27 after sleep current size = 4
[junit] count = 28 after sleep current size = 4
[junit] count = 29 after sleep current size = 4
So I removed all the printlns. What do people think?
Index: src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java
===================================================================
--- src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java
(revision 531033)
+++ src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java
(working copy)
@@ -3,7 +3,7 @@
import junit.framework.TestCase;
/**
- * This test is experiemental. I'm trying to find out if the max size setting
+ * This test is experimental. I'm trying to find out if the max size setting
* will result in the removal of threads.
*
* @author Aaron Smuts
@@ -26,32 +26,21 @@
public void testMaxReduction()
throws Exception
{
- //ThreadPoolManager.setPropsFileName( "thread_pool_test.properties" );
ThreadPool pool = ThreadPoolManager.getInstance().getPool( "maxtest" );
- System.out.println( "pool = " + pool );
-
pool.getPool().setMaximumPoolSize( 5 );
- System.out.println( "current size before execute = " +
pool.getPool().getPoolSize() );
-
-
// add 6
for ( int i = 1; i < 30; i++ )
{
- final ThreadPool myPool = pool;
final int cnt = i;
pool.execute( new Runnable()
{
-
public void run()
{
try
{
- //System.out.println( cnt );
- System.out.println( "count = " + cnt + " before sleep
current size = " + myPool.getPool().getPoolSize() );
Thread.sleep( 200 / cnt );
- System.out.println( "count = " + cnt + " after sleep
current size = " + myPool.getPool().getPoolSize() );
}
catch ( InterruptedException e )
{
@@ -59,24 +48,13 @@
e.printStackTrace();
}
}
-
} );
-
}
- System.out.println( "current size = " + pool.getPool().getPoolSize() );
-
pool.getPool().setMaximumPoolSize( 4 );
- //Thread.sleep( 200 );
-
- System.out.println( "current size after set size to 4= " +
pool.getPool().getPoolSize() );
-
Thread.sleep( 200 );
-
- System.out.println( "current size again after sleep = " +
pool.getPool().getPoolSize() );
assertEquals( "Pool size should have been reduced.", 4,
pool.getPool().getPoolSize() );
}
-
}
|