--- jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java 2009/11/20 16:02:10 1.7 +++ jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java 2009/11/21 02:07:27 1.8 @@ -14,7 +14,7 @@ import java.util.*; public class ThreadPoolExecutorSubclassTest 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(ThreadPoolExecutorSubclassTest.class); @@ -197,7 +197,7 @@ public class ThreadPoolExecutorSubclassT ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); try { p1.execute(new ShortRunnable()); - Thread.sleep(SMALL_DELAY_MS); + Thread.sleep(SMALL_DELAY_MS); } finally { joinPool(p1); } @@ -404,10 +404,10 @@ public class ThreadPoolExecutorSubclassT */ public void testIsShutdown() { - ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p1.isShutdown()); try { p1.shutdown(); } catch (SecurityException ok) { return; } - assertTrue(p1.isShutdown()); + assertTrue(p1.isShutdown()); joinPool(p1); } @@ -416,7 +416,7 @@ public class ThreadPoolExecutorSubclassT * isTerminated is false before termination, true after */ public void testIsTerminated() throws InterruptedException { - ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p1.isTerminated()); try { p1.execute(new MediumRunnable()); @@ -431,7 +431,7 @@ public class ThreadPoolExecutorSubclassT * isTerminating is not true when running or when terminated */ public void testIsTerminating() throws InterruptedException { - ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); assertFalse(p1.isTerminating()); try { p1.execute(new SmallRunnable()); @@ -518,7 +518,7 @@ public class ThreadPoolExecutorSubclassT * shutDownNow returns a list containing tasks that were not run */ public void testShutDownNow() { - ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); + ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10)); List l; try { for (int i = 0; i < 5; i++) @@ -530,8 +530,8 @@ public class ThreadPoolExecutorSubclassT } catch (SecurityException ok) { return; } } - assertTrue(p1.isShutdown()); - assertTrue(l.size() <= 4); + assertTrue(p1.isShutdown()); + assertTrue(l.size() <= 4); } // Exception Tests @@ -921,12 +921,12 @@ public class ThreadPoolExecutorSubclassT ThreadPoolExecutor tpe = new CustomTPE(1,1,LONG_DELAY_MS, TimeUnit.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); } /** @@ -937,9 +937,9 @@ public class ThreadPoolExecutorSubclassT ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.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); @@ -954,9 +954,9 @@ public class ThreadPoolExecutorSubclassT ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.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); @@ -972,9 +972,9 @@ public class ThreadPoolExecutorSubclassT ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.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); @@ -988,24 +988,24 @@ public class ThreadPoolExecutorSubclassT public void testExecuteNull() { ThreadPoolExecutor tpe = null; try { - tpe = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue(10)); - tpe.execute(null); + tpe = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue(10)); + 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 CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.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; } } @@ -1056,12 +1056,12 @@ public class ThreadPoolExecutorSubclassT * when given a negative value */ public void testKeepAliveTimeIllegalArgumentException() { - ThreadPoolExecutor tpe = null; + ThreadPoolExecutor tpe = null; try { tpe = new CustomTPE(2,3,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue(10)); } catch (Exception e) {} - try { + try { tpe.setKeepAliveTime(-1,TimeUnit.MILLISECONDS); shouldThrow(); } catch (IllegalArgumentException success) {