--- jsr166/src/test/tck/ThreadPoolExecutorTest.java 2009/11/20 22:58:48 1.30 +++ jsr166/src/test/tck/ThreadPoolExecutorTest.java 2009/11/21 02:07:27 1.31 @@ -14,7 +14,7 @@ import java.util.*; public class ThreadPoolExecutorTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run (suite()); + junit.textui.TestRunner.run (suite()); } public static Test suite() { return new TestSuite(ThreadPoolExecutorTest.class); @@ -54,7 +54,7 @@ public class ThreadPoolExecutorTest exte ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { p1.execute(new ShortRunnable()); - Thread.sleep(SMALL_DELAY_MS); + Thread.sleep(SMALL_DELAY_MS); } finally { joinPool(p1); } @@ -261,10 +261,10 @@ public class ThreadPoolExecutorTest exte */ public void testIsShutdown() { - ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p1.isShutdown()); try { p1.shutdown(); } catch (SecurityException ok) { return; } - assertTrue(p1.isShutdown()); + assertTrue(p1.isShutdown()); joinPool(p1); } @@ -273,7 +273,7 @@ public class ThreadPoolExecutorTest exte * isTerminated is false before termination, true after */ public void testIsTerminated() throws InterruptedException { - ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p1.isTerminated()); try { p1.execute(new MediumRunnable()); @@ -288,7 +288,7 @@ public class ThreadPoolExecutorTest exte * isTerminating is not true when running or when terminated */ public void testIsTerminating() throws InterruptedException { - ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p1.isTerminating()); try { p1.execute(new SmallRunnable()); @@ -375,7 +375,7 @@ public class ThreadPoolExecutorTest exte * shutDownNow returns a list containing tasks that were not run */ public void testShutDownNow() { - ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); List l; try { for (int i = 0; i < 5; i++) @@ -387,8 +387,8 @@ public class ThreadPoolExecutorTest exte } catch (SecurityException ok) { return; } } - assertTrue(p1.isShutdown()); - assertTrue(l.size() <= 4); + assertTrue(p1.isShutdown()); + assertTrue(l.size() <= 4); } // Exception Tests @@ -785,12 +785,12 @@ public class ThreadPoolExecutorTest exte ThreadPoolExecutor tpe = new ThreadPoolExecutor(1,1,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(1)); try { tpe.shutdown(); } catch (SecurityException ok) { return; } - try { - tpe.execute(new NoOpRunnable()); - shouldThrow(); - } catch (RejectedExecutionException success) {} + try { + tpe.execute(new NoOpRunnable()); + shouldThrow(); + } catch (RejectedExecutionException success) {} - joinPool(tpe); + joinPool(tpe); } /** @@ -801,9 +801,9 @@ public class ThreadPoolExecutorTest exte ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } - try { + try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); - p.execute(r); + p.execute(r); assertFalse(r.done); } finally { joinPool(p); @@ -818,9 +818,9 @@ public class ThreadPoolExecutorTest exte ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } - try { + try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); - p.execute(r); + p.execute(r); assertFalse(r.done); } finally { joinPool(p); @@ -836,9 +836,9 @@ public class ThreadPoolExecutorTest exte ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(1), h); try { p.shutdown(); } catch (SecurityException ok) { return; } - try { + try { TrackedNoOpRunnable r = new TrackedNoOpRunnable(); - p.execute(r); + p.execute(r); assertFalse(r.done); } finally { joinPool(p); @@ -852,25 +852,25 @@ public class ThreadPoolExecutorTest exte public void testExecuteNull() { ThreadPoolExecutor tpe = new ThreadPoolExecutor(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue(10)); try { - tpe.execute(null); + tpe.execute(null); shouldThrow(); - } catch (NullPointerException success) {} + } catch (NullPointerException success) {} - joinPool(tpe); + joinPool(tpe); } /** * setCorePoolSize of negative value throws IllegalArgumentException */ public void testCorePoolSizeIllegalArgumentException() { - ThreadPoolExecutor tpe = + ThreadPoolExecutor tpe = new ThreadPoolExecutor(1, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); - try { - tpe.setCorePoolSize(-1); - shouldThrow(); - } catch (IllegalArgumentException success) { + try { + tpe.setCorePoolSize(-1); + shouldThrow(); + } catch (IllegalArgumentException success) { } finally { try { tpe.shutdown(); } catch (SecurityException ok) { return; } } @@ -921,11 +921,11 @@ public class ThreadPoolExecutorTest exte * when given a negative value */ public void testKeepAliveTimeIllegalArgumentException() { - ThreadPoolExecutor tpe = + ThreadPoolExecutor tpe = new ThreadPoolExecutor(2, 3, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); - try { + try { tpe.setKeepAliveTime(-1,MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) {