--- jsr166/src/test/tck/ScheduledExecutorSubclassTest.java 2005/05/20 16:30:17 1.1 +++ jsr166/src/test/tck/ScheduledExecutorSubclassTest.java 2009/11/16 04:57:10 1.3 @@ -11,24 +11,24 @@ import java.util.concurrent.atomic.*; public class ScheduledExecutorSubclassTest 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(ScheduledExecutorTest.class); } - static class CustomTask implements RunnableScheduledFuture { + static class CustomTask implements RunnableScheduledFuture { RunnableScheduledFuture task; volatile boolean ran; CustomTask(RunnableScheduledFuture t) { task = t; } public boolean isPeriodic() { return task.isPeriodic(); } - public void run() { + public void run() { ran = true; - task.run(); + task.run(); } public long getDelay(TimeUnit unit) { return task.getDelay(unit); } public int compareTo(Delayed t) { - return task.compareTo(((CustomTask)t).task); + return task.compareTo(((CustomTask)t).task); } public boolean cancel(boolean mayInterruptIfRunning) { return task.cancel(mayInterruptIfRunning); @@ -46,7 +46,7 @@ public class ScheduledExecutorSubclassTe return v; } } - + public class CustomExecutor extends ScheduledThreadPoolExecutor { @@ -65,13 +65,13 @@ public class ScheduledExecutorSubclassTe CustomExecutor(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); } - CustomExecutor(int corePoolSize, ThreadFactory threadFactory, + CustomExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler) { super(corePoolSize, threadFactory, handler); } - + } - + /** @@ -84,20 +84,20 @@ public class ScheduledExecutorSubclassTe p1.execute(runnable); assertFalse(runnable.done); Thread.sleep(SHORT_DELAY_MS); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } try { Thread.sleep(MEDIUM_DELAY_MS); - } catch(InterruptedException e){ + } catch (InterruptedException e){ unexpectedException(); } assertTrue(runnable.done); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } joinPool(p1); } - catch(Exception e){ + catch (Exception e){ unexpectedException(); } - + } @@ -113,10 +113,10 @@ public class ScheduledExecutorSubclassTe Thread.sleep(MEDIUM_DELAY_MS); assertTrue(callable.done); assertEquals(Boolean.TRUE, f.get()); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } joinPool(p1); - } catch(RejectedExecutionException e){} - catch(Exception e){ + } catch (RejectedExecutionException e){} + catch (Exception e){ e.printStackTrace(); unexpectedException(); } @@ -134,13 +134,13 @@ public class ScheduledExecutorSubclassTe assertFalse(runnable.done); Thread.sleep(MEDIUM_DELAY_MS); assertTrue(runnable.done); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } joinPool(p1); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } } - + /** * scheduleAtFixedRate executes runnable after given initial delay */ @@ -154,7 +154,7 @@ public class ScheduledExecutorSubclassTe assertTrue(runnable.done); h.cancel(true); joinPool(p1); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } } @@ -177,11 +177,11 @@ public class ScheduledExecutorSubclassTe assertTrue(runnable.done); h.cancel(true); joinPool(p1); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } } - + /** * scheduleAtFixedRate executes series of tasks at given rate */ @@ -189,7 +189,7 @@ public class ScheduledExecutorSubclassTe try { CustomExecutor p1 = new CustomExecutor(1); RunnableCounter counter = new RunnableCounter(); - ScheduledFuture h = + ScheduledFuture h = p1.scheduleAtFixedRate(counter, 0, 1, TimeUnit.MILLISECONDS); Thread.sleep(SMALL_DELAY_MS); h.cancel(true); @@ -199,7 +199,7 @@ public class ScheduledExecutorSubclassTe assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS); assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS); joinPool(p1); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } } @@ -211,7 +211,7 @@ public class ScheduledExecutorSubclassTe try { CustomExecutor p1 = new CustomExecutor(1); RunnableCounter counter = new RunnableCounter(); - ScheduledFuture h = + ScheduledFuture h = p1.scheduleWithFixedDelay(counter, 0, 1, TimeUnit.MILLISECONDS); Thread.sleep(SMALL_DELAY_MS); h.cancel(true); @@ -219,7 +219,7 @@ public class ScheduledExecutorSubclassTe assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS); assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS); joinPool(p1); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } } @@ -234,11 +234,11 @@ public class ScheduledExecutorSubclassTe se = new CustomExecutor(1); se.execute(null); shouldThrow(); - } catch(NullPointerException success){} - catch(Exception e){ + } catch (NullPointerException success){} + catch (Exception e){ unexpectedException(); } - + joinPool(se); } @@ -251,13 +251,13 @@ public class ScheduledExecutorSubclassTe TrackedCallable callable = null; Future f = se.schedule(callable, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); shouldThrow(); - } catch(NullPointerException success){} - catch(Exception e){ + } catch (NullPointerException success){} + catch (Exception e){ unexpectedException(); } joinPool(se); } - + /** * execute throws RejectedExecutionException if shutdown */ @@ -268,10 +268,10 @@ public class ScheduledExecutorSubclassTe se.schedule(new NoOpRunnable(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); shouldThrow(); - } catch(RejectedExecutionException success){ + } catch (RejectedExecutionException success){ } catch (SecurityException ok) { } - + joinPool(se); } @@ -286,7 +286,7 @@ public class ScheduledExecutorSubclassTe se.schedule(new NoOpCallable(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); shouldThrow(); - } catch(RejectedExecutionException success){ + } catch (RejectedExecutionException success){ } catch (SecurityException ok) { } joinPool(se); @@ -302,7 +302,7 @@ public class ScheduledExecutorSubclassTe se.schedule(new NoOpCallable(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); shouldThrow(); - } catch(RejectedExecutionException success){ + } catch (RejectedExecutionException success){ } catch (SecurityException ok) { } joinPool(se); @@ -318,12 +318,12 @@ public class ScheduledExecutorSubclassTe se.scheduleAtFixedRate(new NoOpRunnable(), MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); shouldThrow(); - } catch(RejectedExecutionException success){ + } catch (RejectedExecutionException success){ } catch (SecurityException ok) { - } + } joinPool(se); } - + /** * scheduleWithFixedDelay throws RejectedExecutionException if shutdown */ @@ -334,9 +334,9 @@ public class ScheduledExecutorSubclassTe se.scheduleWithFixedDelay(new NoOpRunnable(), MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); shouldThrow(); - } catch(RejectedExecutionException success){ + } catch (RejectedExecutionException success){ } catch (SecurityException ok) { - } + } joinPool(se); } @@ -350,13 +350,13 @@ public class ScheduledExecutorSubclassTe p2.execute(new SmallRunnable()); try { Thread.sleep(SHORT_DELAY_MS); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } assertEquals(1, p2.getActiveCount()); joinPool(p2); } - + /** * getCompletedTaskCount increases, but doesn't overestimate, * when tasks complete @@ -367,22 +367,22 @@ public class ScheduledExecutorSubclassTe p2.execute(new SmallRunnable()); try { Thread.sleep(MEDIUM_DELAY_MS); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } assertEquals(1, p2.getCompletedTaskCount()); joinPool(p2); } - + /** - * getCorePoolSize returns size given in constructor if not otherwise set + * getCorePoolSize returns size given in constructor if not otherwise set */ public void testGetCorePoolSize() { CustomExecutor p1 = new CustomExecutor(1); assertEquals(1, p1.getCorePoolSize()); joinPool(p1); } - + /** * getLargestPoolSize increases, but doesn't overestimate, when * multiple threads active @@ -394,13 +394,13 @@ public class ScheduledExecutorSubclassTe p2.execute(new SmallRunnable()); try { Thread.sleep(SHORT_DELAY_MS); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } assertEquals(2, p2.getLargestPoolSize()); joinPool(p2); } - + /** * getPoolSize increases, but doesn't overestimate, when threads * become active @@ -412,7 +412,7 @@ public class ScheduledExecutorSubclassTe assertEquals(1, p1.getPoolSize()); joinPool(p1); } - + /** * getTaskCount increases, but doesn't overestimate, when tasks * submitted @@ -420,18 +420,18 @@ public class ScheduledExecutorSubclassTe public void testGetTaskCount() { CustomExecutor p1 = new CustomExecutor(1); assertEquals(0, p1.getTaskCount()); - for(int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) p1.execute(new SmallRunnable()); try { Thread.sleep(SHORT_DELAY_MS); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); } assertEquals(5, p1.getTaskCount()); joinPool(p1); } - /** + /** * getThreadFactory returns factory in constructor if not set */ public void testGetThreadFactory() { @@ -441,7 +441,7 @@ public class ScheduledExecutorSubclassTe joinPool(p); } - /** + /** * setThreadFactory sets the thread factory returned by getThreadFactory */ public void testSetThreadFactory() { @@ -452,7 +452,7 @@ public class ScheduledExecutorSubclassTe joinPool(p); } - /** + /** * setThreadFactory(null) throws NPE */ public void testSetThreadFactoryNull() { @@ -465,23 +465,23 @@ public class ScheduledExecutorSubclassTe joinPool(p); } } - + /** * is isShutDown is false before shutdown, true after */ public void testIsShutdown() { - + CustomExecutor p1 = new CustomExecutor(1); try { assertFalse(p1.isShutdown()); } finally { - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } } assertTrue(p1.isShutdown()); } - + /** * isTerminated is false before termination, true after */ @@ -490,14 +490,14 @@ public class ScheduledExecutorSubclassTe try { p1.execute(new SmallRunnable()); } finally { - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } } try { assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS)); assertTrue(p1.isTerminated()); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); - } + } } /** @@ -510,15 +510,15 @@ public class ScheduledExecutorSubclassTe p1.execute(new SmallRunnable()); assertFalse(p1.isTerminating()); } finally { - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } } try { assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS)); assertTrue(p1.isTerminated()); assertFalse(p1.isTerminating()); - } catch(Exception e){ + } catch (Exception e){ unexpectedException(); - } + } } /** @@ -527,7 +527,7 @@ public class ScheduledExecutorSubclassTe public void testGetQueue() { CustomExecutor p1 = new CustomExecutor(1); ScheduledFuture[] tasks = new ScheduledFuture[5]; - for(int i = 0; i < 5; i++){ + for (int i = 0; i < 5; i++){ tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), 1, TimeUnit.MILLISECONDS); } try { @@ -535,7 +535,7 @@ public class ScheduledExecutorSubclassTe BlockingQueue q = p1.getQueue(); assertTrue(q.contains(tasks[4])); assertFalse(q.contains(tasks[0])); - } catch(Exception e) { + } catch (Exception e) { unexpectedException(); } finally { joinPool(p1); @@ -548,7 +548,7 @@ public class ScheduledExecutorSubclassTe public void testRemove() { CustomExecutor p1 = new CustomExecutor(1); ScheduledFuture[] tasks = new ScheduledFuture[5]; - for(int i = 0; i < 5; i++){ + for (int i = 0; i < 5; i++){ tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), 1, TimeUnit.MILLISECONDS); } try { @@ -563,7 +563,7 @@ public class ScheduledExecutorSubclassTe assertTrue(q.contains((Runnable)tasks[3])); assertTrue(p1.remove((Runnable)tasks[3])); assertFalse(q.contains((Runnable)tasks[3])); - } catch(Exception e) { + } catch (Exception e) { unexpectedException(); } finally { joinPool(p1); @@ -576,7 +576,7 @@ public class ScheduledExecutorSubclassTe public void testPurge() { CustomExecutor p1 = new CustomExecutor(1); ScheduledFuture[] tasks = new ScheduledFuture[5]; - for(int i = 0; i < 5; i++){ + for (int i = 0; i < 5; i++){ tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS); } try { @@ -594,7 +594,7 @@ public class ScheduledExecutorSubclassTe Thread.sleep(1); } assertTrue(k < SMALL_DELAY_MS); - } catch(Exception e) { + } catch (Exception e) { unexpectedException(); } finally { joinPool(p1); @@ -606,12 +606,12 @@ public class ScheduledExecutorSubclassTe */ public void testShutDownNow() { CustomExecutor p1 = new CustomExecutor(1); - for(int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) p1.schedule(new SmallPossiblyInterruptedRunnable(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS); List l; try { l = p1.shutdownNow(); - } catch (SecurityException ok) { + } catch (SecurityException ok) { return; } assertTrue(p1.isShutdown()); @@ -630,9 +630,9 @@ public class ScheduledExecutorSubclassTe assertFalse(p1.getContinueExistingPeriodicTasksAfterShutdownPolicy()); ScheduledFuture[] tasks = new ScheduledFuture[5]; - for(int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) tasks[i] = p1.schedule(new NoOpRunnable(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } BlockingQueue q = p1.getQueue(); for (Iterator it = q.iterator(); it.hasNext();) { ScheduledFuture t = (ScheduledFuture)it.next(); @@ -644,9 +644,9 @@ public class ScheduledExecutorSubclassTe assertTrue(tasks[i].isDone()); assertFalse(tasks[i].isCancelled()); } - + } - catch(Exception ex) { + catch (Exception ex) { unexpectedException(); } } @@ -661,16 +661,16 @@ public class ScheduledExecutorSubclassTe CustomExecutor p1 = new CustomExecutor(1); p1.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); ScheduledFuture[] tasks = new ScheduledFuture[5]; - for(int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) tasks[i] = p1.schedule(new NoOpRunnable(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p1.isShutdown()); BlockingQueue q = p1.getQueue(); assertTrue(q.isEmpty()); Thread.sleep(SMALL_DELAY_MS); assertTrue(p1.isTerminated()); } - catch(Exception ex) { + catch (Exception ex) { unexpectedException(); } } @@ -686,14 +686,14 @@ public class ScheduledExecutorSubclassTe p1.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); ScheduledFuture task = p1.scheduleAtFixedRate(new NoOpRunnable(), 5, 5, TimeUnit.MILLISECONDS); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } assertTrue(p1.isShutdown()); BlockingQueue q = p1.getQueue(); assertTrue(q.isEmpty()); Thread.sleep(SHORT_DELAY_MS); assertTrue(p1.isTerminated()); } - catch(Exception ex) { + catch (Exception ex) { unexpectedException(); } } @@ -709,7 +709,7 @@ public class ScheduledExecutorSubclassTe ScheduledFuture task = p1.scheduleAtFixedRate(new NoOpRunnable(), 1, 1, TimeUnit.MILLISECONDS); assertFalse(task.isCancelled()); - try { p1.shutdown(); } catch(SecurityException ok) { return; } + try { p1.shutdown(); } catch (SecurityException ok) { return; } assertFalse(task.isCancelled()); assertFalse(p1.isTerminated()); assertTrue(p1.isShutdown()); @@ -720,10 +720,10 @@ public class ScheduledExecutorSubclassTe Thread.sleep(SHORT_DELAY_MS); assertTrue(p1.isTerminated()); } - catch(Exception ex) { + catch (Exception ex) { unexpectedException(); } - finally { + finally { joinPool(p1); } } @@ -796,7 +796,7 @@ public class ScheduledExecutorSubclassTe try { e.invokeAny(null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -811,7 +811,7 @@ public class ScheduledExecutorSubclassTe try { e.invokeAny(new ArrayList>()); } catch (IllegalArgumentException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -829,7 +829,7 @@ public class ScheduledExecutorSubclassTe l.add(null); e.invokeAny(l); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -846,7 +846,7 @@ public class ScheduledExecutorSubclassTe l.add(new NPETask()); e.invokeAny(l); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -865,7 +865,7 @@ public class ScheduledExecutorSubclassTe String result = e.invokeAny(l); assertSame(TEST_STRING, result); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -880,7 +880,7 @@ public class ScheduledExecutorSubclassTe try { e.invokeAll(null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -895,7 +895,7 @@ public class ScheduledExecutorSubclassTe try { List> r = e.invokeAll(new ArrayList>()); assertTrue(r.isEmpty()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -913,7 +913,7 @@ public class ScheduledExecutorSubclassTe l.add(null); e.invokeAll(l); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -930,10 +930,10 @@ public class ScheduledExecutorSubclassTe l.add(new NPETask()); List> result = e.invokeAll(l); assertEquals(1, result.size()); - for (Iterator> it = result.iterator(); it.hasNext();) + for (Iterator> it = result.iterator(); it.hasNext();) it.next().get(); - } catch(ExecutionException success) { - } catch(Exception ex) { + } catch (ExecutionException success) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -951,10 +951,10 @@ public class ScheduledExecutorSubclassTe l.add(new StringTask()); List> result = e.invokeAll(l); assertEquals(2, result.size()); - for (Iterator> it = result.iterator(); it.hasNext();) + for (Iterator> it = result.iterator(); it.hasNext();) assertSame(TEST_STRING, it.next().get()); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -969,7 +969,7 @@ public class ScheduledExecutorSubclassTe try { e.invokeAny(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -986,7 +986,7 @@ public class ScheduledExecutorSubclassTe l.add(new StringTask()); e.invokeAny(l, MEDIUM_DELAY_MS, null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1001,7 +1001,7 @@ public class ScheduledExecutorSubclassTe try { e.invokeAny(new ArrayList>(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (IllegalArgumentException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1019,7 +1019,7 @@ public class ScheduledExecutorSubclassTe l.add(null); e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); unexpectedException(); } finally { @@ -1036,8 +1036,8 @@ public class ScheduledExecutorSubclassTe ArrayList> l = new ArrayList>(); l.add(new NPETask()); e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); - } catch(ExecutionException success) { - } catch(Exception ex) { + } catch (ExecutionException success) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1056,7 +1056,7 @@ public class ScheduledExecutorSubclassTe String result = e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); assertSame(TEST_STRING, result); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1071,7 +1071,7 @@ public class ScheduledExecutorSubclassTe try { e.invokeAll(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1088,7 +1088,7 @@ public class ScheduledExecutorSubclassTe l.add(new StringTask()); e.invokeAll(l, MEDIUM_DELAY_MS, null); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1103,7 +1103,7 @@ public class ScheduledExecutorSubclassTe try { List> r = e.invokeAll(new ArrayList>(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); assertTrue(r.isEmpty()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1121,7 +1121,7 @@ public class ScheduledExecutorSubclassTe l.add(null); e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); } catch (NullPointerException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1138,10 +1138,10 @@ public class ScheduledExecutorSubclassTe l.add(new NPETask()); List> result = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); assertEquals(1, result.size()); - for (Iterator> it = result.iterator(); it.hasNext();) + for (Iterator> it = result.iterator(); it.hasNext();) it.next().get(); - } catch(ExecutionException success) { - } catch(Exception ex) { + } catch (ExecutionException success) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1159,10 +1159,10 @@ public class ScheduledExecutorSubclassTe l.add(new StringTask()); List> result = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); assertEquals(2, result.size()); - for (Iterator> it = result.iterator(); it.hasNext();) + for (Iterator> it = result.iterator(); it.hasNext();) assertSame(TEST_STRING, it.next().get()); } catch (ExecutionException success) { - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e); @@ -1181,7 +1181,7 @@ public class ScheduledExecutorSubclassTe l.add(new StringTask()); List> result = e.invokeAll(l, SHORT_DELAY_MS, TimeUnit.MILLISECONDS); assertEquals(3, result.size()); - Iterator> it = result.iterator(); + Iterator> it = result.iterator(); Future f1 = it.next(); Future f2 = it.next(); Future f3 = it.next(); @@ -1190,7 +1190,7 @@ public class ScheduledExecutorSubclassTe assertTrue(f3.isDone()); assertFalse(f1.isCancelled()); assertTrue(f2.isCancelled()); - } catch(Exception ex) { + } catch (Exception ex) { unexpectedException(); } finally { joinPool(e);