ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java (file contents):
Revision 1.7 by jsr166, Fri Nov 20 16:02:10 2009 UTC vs.
Revision 1.20 by jsr166, Sat Oct 9 22:27:16 2010 UTC

# Line 7 | Line 7
7   */
8  
9   import java.util.concurrent.*;
10 + import static java.util.concurrent.TimeUnit.MILLISECONDS;
11   import java.util.concurrent.locks.*;
12  
13   import junit.framework.*;
# Line 14 | Line 15 | import java.util.*;
15  
16   public class ThreadPoolExecutorSubclassTest extends JSR166TestCase {
17      public static void main(String[] args) {
18 <        junit.textui.TestRunner.run(suite());
18 >        junit.textui.TestRunner.run(suite());
19      }
20      public static Test suite() {
21          return new TestSuite(ThreadPoolExecutorSubclassTest.class);
# Line 167 | Line 168 | public class ThreadPoolExecutorSubclassT
168          volatile boolean afterCalled = false;
169          volatile boolean terminatedCalled = false;
170          public CustomTPE() {
171 <            super(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>());
171 >            super(1, 1, LONG_DELAY_MS, MILLISECONDS, new SynchronousQueue<Runnable>());
172          }
173          protected void beforeExecute(Thread t, Runnable r) {
174              beforeCalled = true;
# Line 191 | Line 192 | public class ThreadPoolExecutorSubclassT
192  
193  
194      /**
195 <     *  execute successfully executes a runnable
195 >     * execute successfully executes a runnable
196       */
197      public void testExecute() throws InterruptedException {
198 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
198 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
199          try {
200              p1.execute(new ShortRunnable());
201 <            Thread.sleep(SMALL_DELAY_MS);
201 >            Thread.sleep(SMALL_DELAY_MS);
202          } finally {
203              joinPool(p1);
204          }
205      }
206  
207      /**
208 <     *  getActiveCount increases but doesn't overestimate, when a
209 <     *  thread becomes active
208 >     * getActiveCount increases but doesn't overestimate, when a
209 >     * thread becomes active
210       */
211      public void testGetActiveCount() throws InterruptedException {
212 <        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
212 >        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
213          assertEquals(0, p2.getActiveCount());
214          p2.execute(new MediumRunnable());
215          Thread.sleep(SHORT_DELAY_MS);
# Line 217 | Line 218 | public class ThreadPoolExecutorSubclassT
218      }
219  
220      /**
221 <     *  prestartCoreThread starts a thread if under corePoolSize, else doesn't
221 >     * prestartCoreThread starts a thread if under corePoolSize, else doesn't
222       */
223      public void testPrestartCoreThread() {
224 <        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
224 >        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
225          assertEquals(0, p2.getPoolSize());
226          assertTrue(p2.prestartCoreThread());
227          assertEquals(1, p2.getPoolSize());
# Line 232 | Line 233 | public class ThreadPoolExecutorSubclassT
233      }
234  
235      /**
236 <     *  prestartAllCoreThreads starts all corePoolSize threads
236 >     * prestartAllCoreThreads starts all corePoolSize threads
237       */
238      public void testPrestartAllCoreThreads() {
239 <        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
239 >        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
240          assertEquals(0, p2.getPoolSize());
241          p2.prestartAllCoreThreads();
242          assertEquals(2, p2.getPoolSize());
# Line 245 | Line 246 | public class ThreadPoolExecutorSubclassT
246      }
247  
248      /**
249 <     *   getCompletedTaskCount increases, but doesn't overestimate,
250 <     *   when tasks complete
249 >     * getCompletedTaskCount increases, but doesn't overestimate,
250 >     * when tasks complete
251       */
252      public void testGetCompletedTaskCount() throws InterruptedException {
253 <        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
253 >        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
254          assertEquals(0, p2.getCompletedTaskCount());
255          p2.execute(new ShortRunnable());
256          Thread.sleep(SMALL_DELAY_MS);
# Line 259 | Line 260 | public class ThreadPoolExecutorSubclassT
260      }
261  
262      /**
263 <     *   getCorePoolSize returns size given in constructor if not otherwise set
263 >     * getCorePoolSize returns size given in constructor if not otherwise set
264       */
265      public void testGetCorePoolSize() {
266 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
266 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
267          assertEquals(1, p1.getCorePoolSize());
268          joinPool(p1);
269      }
270  
271      /**
272 <     *   getKeepAliveTime returns value given in constructor if not otherwise set
272 >     * getKeepAliveTime returns value given in constructor if not otherwise set
273       */
274      public void testGetKeepAliveTime() {
275 <        ThreadPoolExecutor p2 = new CustomTPE(2, 2, 1000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
275 >        ThreadPoolExecutor p2 = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
276          assertEquals(1, p2.getKeepAliveTime(TimeUnit.SECONDS));
277          joinPool(p2);
278      }
# Line 282 | Line 283 | public class ThreadPoolExecutorSubclassT
283       */
284      public void testGetThreadFactory() {
285          ThreadFactory tf = new SimpleThreadFactory();
286 <        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10), tf, new NoOpREHandler());
286 >        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10), tf, new NoOpREHandler());
287          assertSame(tf, p.getThreadFactory());
288          joinPool(p);
289      }
# Line 291 | Line 292 | public class ThreadPoolExecutorSubclassT
292       * setThreadFactory sets the thread factory returned by getThreadFactory
293       */
294      public void testSetThreadFactory() {
295 <        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
295 >        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
296          ThreadFactory tf = new SimpleThreadFactory();
297          p.setThreadFactory(tf);
298          assertSame(tf, p.getThreadFactory());
# Line 303 | Line 304 | public class ThreadPoolExecutorSubclassT
304       * setThreadFactory(null) throws NPE
305       */
306      public void testSetThreadFactoryNull() {
307 <        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
307 >        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
308          try {
309              p.setThreadFactory(null);
310              shouldThrow();
# Line 318 | Line 319 | public class ThreadPoolExecutorSubclassT
319       */
320      public void testGetRejectedExecutionHandler() {
321          RejectedExecutionHandler h = new NoOpREHandler();
322 <        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10), h);
322 >        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10), h);
323          assertSame(h, p.getRejectedExecutionHandler());
324          joinPool(p);
325      }
# Line 328 | Line 329 | public class ThreadPoolExecutorSubclassT
329       * getRejectedExecutionHandler
330       */
331      public void testSetRejectedExecutionHandler() {
332 <        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
332 >        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
333          RejectedExecutionHandler h = new NoOpREHandler();
334          p.setRejectedExecutionHandler(h);
335          assertSame(h, p.getRejectedExecutionHandler());
# Line 340 | Line 341 | public class ThreadPoolExecutorSubclassT
341       * setRejectedExecutionHandler(null) throws NPE
342       */
343      public void testSetRejectedExecutionHandlerNull() {
344 <        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
344 >        ThreadPoolExecutor p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
345          try {
346              p.setRejectedExecutionHandler(null);
347              shouldThrow();
# Line 352 | Line 353 | public class ThreadPoolExecutorSubclassT
353  
354  
355      /**
356 <     *   getLargestPoolSize increases, but doesn't overestimate, when
357 <     *   multiple threads active
356 >     * getLargestPoolSize increases, but doesn't overestimate, when
357 >     * multiple threads active
358       */
359      public void testGetLargestPoolSize() throws InterruptedException {
360 <        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
360 >        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
361          assertEquals(0, p2.getLargestPoolSize());
362          p2.execute(new MediumRunnable());
363          p2.execute(new MediumRunnable());
# Line 366 | Line 367 | public class ThreadPoolExecutorSubclassT
367      }
368  
369      /**
370 <     *   getMaximumPoolSize returns value given in constructor if not
371 <     *   otherwise set
370 >     * getMaximumPoolSize returns value given in constructor if not
371 >     * otherwise set
372       */
373      public void testGetMaximumPoolSize() {
374 <        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
374 >        ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
375          assertEquals(2, p2.getMaximumPoolSize());
376          joinPool(p2);
377      }
378  
379      /**
380 <     *   getPoolSize increases, but doesn't overestimate, when threads
381 <     *   become active
380 >     * getPoolSize increases, but doesn't overestimate, when threads
381 >     * become active
382       */
383      public void testGetPoolSize() {
384 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
384 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
385          assertEquals(0, p1.getPoolSize());
386          p1.execute(new MediumRunnable());
387          assertEquals(1, p1.getPoolSize());
# Line 388 | Line 389 | public class ThreadPoolExecutorSubclassT
389      }
390  
391      /**
392 <     *  getTaskCount increases, but doesn't overestimate, when tasks submitted
392 >     * getTaskCount increases, but doesn't overestimate, when tasks submitted
393       */
394      public void testGetTaskCount() throws InterruptedException {
395 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
395 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
396          assertEquals(0, p1.getTaskCount());
397          p1.execute(new MediumRunnable());
398          Thread.sleep(SHORT_DELAY_MS);
# Line 400 | Line 401 | public class ThreadPoolExecutorSubclassT
401      }
402  
403      /**
404 <     *   isShutDown is false before shutdown, true after
404 >     * isShutDown is false before shutdown, true after
405       */
406      public void testIsShutdown() {
407  
408 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
408 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
409          assertFalse(p1.isShutdown());
410          try { p1.shutdown(); } catch (SecurityException ok) { return; }
411 <        assertTrue(p1.isShutdown());
411 >        assertTrue(p1.isShutdown());
412          joinPool(p1);
413      }
414  
415  
416      /**
417 <     *  isTerminated is false before termination, true after
417 >     * isTerminated is false before termination, true after
418       */
419      public void testIsTerminated() throws InterruptedException {
420 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
420 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
421          assertFalse(p1.isTerminated());
422          try {
423              p1.execute(new MediumRunnable());
424          } finally {
425              try { p1.shutdown(); } catch (SecurityException ok) { return; }
426          }
427 <        assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
427 >        assertTrue(p1.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
428          assertTrue(p1.isTerminated());
429      }
430  
431      /**
432 <     *  isTerminating is not true when running or when terminated
432 >     * isTerminating is not true when running or when terminated
433       */
434      public void testIsTerminating() throws InterruptedException {
435 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
435 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
436          assertFalse(p1.isTerminating());
437          try {
438              p1.execute(new SmallRunnable());
# Line 439 | Line 440 | public class ThreadPoolExecutorSubclassT
440          } finally {
441              try { p1.shutdown(); } catch (SecurityException ok) { return; }
442          }
443 <        assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
443 >        assertTrue(p1.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
444          assertTrue(p1.isTerminated());
445          assertFalse(p1.isTerminating());
446      }
# Line 449 | Line 450 | public class ThreadPoolExecutorSubclassT
450       */
451      public void testGetQueue() throws InterruptedException {
452          BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10);
453 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, q);
453 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, q);
454          FutureTask[] tasks = new FutureTask[5];
455          for (int i = 0; i < 5; i++) {
456              tasks[i] = new FutureTask(new MediumPossiblyInterruptedRunnable(), Boolean.TRUE);
# Line 474 | Line 475 | public class ThreadPoolExecutorSubclassT
475       */
476      public void testRemove() throws InterruptedException {
477          BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10);
478 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, q);
478 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, q);
479          FutureTask[] tasks = new FutureTask[5];
480          for (int i = 0; i < 5; i++) {
481              tasks[i] = new FutureTask(new MediumPossiblyInterruptedRunnable(), Boolean.TRUE);
# Line 497 | Line 498 | public class ThreadPoolExecutorSubclassT
498      }
499  
500      /**
501 <     *   purge removes cancelled tasks from the queue
501 >     * purge removes cancelled tasks from the queue
502       */
503      public void testPurge() {
504 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
504 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
505          FutureTask[] tasks = new FutureTask[5];
506          for (int i = 0; i < 5; i++) {
507              tasks[i] = new FutureTask(new MediumPossiblyInterruptedRunnable(), Boolean.TRUE);
# Line 515 | Line 516 | public class ThreadPoolExecutorSubclassT
516      }
517  
518      /**
519 <     *  shutDownNow returns a list containing tasks that were not run
519 >     * shutDownNow returns a list containing tasks that were not run
520       */
521      public void testShutDownNow() {
522 <        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
522 >        ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
523          List l;
524          try {
525              for (int i = 0; i < 5; i++)
# Line 528 | Line 529 | public class ThreadPoolExecutorSubclassT
529              try {
530                  l = p1.shutdownNow();
531              } catch (SecurityException ok) { return; }
531
532          }
533 <        assertTrue(p1.isShutdown());
534 <        assertTrue(l.size() <= 4);
533 >        assertTrue(p1.isShutdown());
534 >        assertTrue(l.size() <= 4);
535      }
536  
537      // Exception Tests
# Line 542 | Line 542 | public class ThreadPoolExecutorSubclassT
542       */
543      public void testConstructor1() {
544          try {
545 <            new CustomTPE(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
545 >            new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
546              shouldThrow();
547          } catch (IllegalArgumentException success) {}
548      }
# Line 552 | Line 552 | public class ThreadPoolExecutorSubclassT
552       */
553      public void testConstructor2() {
554          try {
555 <            new CustomTPE(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
555 >            new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
556              shouldThrow();
557          } catch (IllegalArgumentException success) {}
558      }
# Line 562 | Line 562 | public class ThreadPoolExecutorSubclassT
562       */
563      public void testConstructor3() {
564          try {
565 <            new CustomTPE(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
565 >            new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
566              shouldThrow();
567          } catch (IllegalArgumentException success) {}
568      }
# Line 572 | Line 572 | public class ThreadPoolExecutorSubclassT
572       */
573      public void testConstructor4() {
574          try {
575 <            new CustomTPE(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
575 >            new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
576              shouldThrow();
577          } catch (IllegalArgumentException success) {}
578      }
# Line 582 | Line 582 | public class ThreadPoolExecutorSubclassT
582       */
583      public void testConstructor5() {
584          try {
585 <            new CustomTPE(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
585 >            new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
586              shouldThrow();
587          } catch (IllegalArgumentException success) {}
588      }
# Line 592 | Line 592 | public class ThreadPoolExecutorSubclassT
592       */
593      public void testConstructorNullPointerException() {
594          try {
595 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null);
595 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null);
596              shouldThrow();
597          } catch (NullPointerException success) {}
598      }
# Line 604 | Line 604 | public class ThreadPoolExecutorSubclassT
604       */
605      public void testConstructor6() {
606          try {
607 <            new CustomTPE(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
607 >            new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
608              shouldThrow();
609          } catch (IllegalArgumentException success) {}
610      }
# Line 614 | Line 614 | public class ThreadPoolExecutorSubclassT
614       */
615      public void testConstructor7() {
616          try {
617 <            new CustomTPE(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
617 >            new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
618              shouldThrow();
619          } catch (IllegalArgumentException success) {}
620      }
# Line 624 | Line 624 | public class ThreadPoolExecutorSubclassT
624       */
625      public void testConstructor8() {
626          try {
627 <            new CustomTPE(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
627 >            new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
628              shouldThrow();
629          } catch (IllegalArgumentException success) {}
630      }
# Line 634 | Line 634 | public class ThreadPoolExecutorSubclassT
634       */
635      public void testConstructor9() {
636          try {
637 <            new CustomTPE(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
637 >            new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
638              shouldThrow();
639          } catch (IllegalArgumentException success) {}
640      }
# Line 644 | Line 644 | public class ThreadPoolExecutorSubclassT
644       */
645      public void testConstructor10() {
646          try {
647 <            new CustomTPE(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
647 >            new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
648              shouldThrow();
649          } catch (IllegalArgumentException success) {}
650      }
# Line 654 | Line 654 | public class ThreadPoolExecutorSubclassT
654       */
655      public void testConstructorNullPointerException2() {
656          try {
657 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null,new SimpleThreadFactory());
657 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new SimpleThreadFactory());
658              shouldThrow();
659          } catch (NullPointerException success) {}
660      }
# Line 665 | Line 665 | public class ThreadPoolExecutorSubclassT
665      public void testConstructorNullPointerException3() {
666          try {
667              ThreadFactory f = null;
668 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f);
668 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f);
669              shouldThrow();
670          } catch (NullPointerException success) {}
671      }
# Line 676 | Line 676 | public class ThreadPoolExecutorSubclassT
676       */
677      public void testConstructor11() {
678          try {
679 <            new CustomTPE(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
679 >            new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
680              shouldThrow();
681          } catch (IllegalArgumentException success) {}
682      }
# Line 686 | Line 686 | public class ThreadPoolExecutorSubclassT
686       */
687      public void testConstructor12() {
688          try {
689 <            new CustomTPE(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
689 >            new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
690              shouldThrow();
691          } catch (IllegalArgumentException success) {}
692      }
# Line 696 | Line 696 | public class ThreadPoolExecutorSubclassT
696       */
697      public void testConstructor13() {
698          try {
699 <            new CustomTPE(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
699 >            new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
700              shouldThrow();
701          } catch (IllegalArgumentException success) {}
702      }
# Line 706 | Line 706 | public class ThreadPoolExecutorSubclassT
706       */
707      public void testConstructor14() {
708          try {
709 <            new CustomTPE(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
709 >            new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
710              shouldThrow();
711          } catch (IllegalArgumentException success) {}
712      }
# Line 716 | Line 716 | public class ThreadPoolExecutorSubclassT
716       */
717      public void testConstructor15() {
718          try {
719 <            new CustomTPE(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
719 >            new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
720              shouldThrow();
721          } catch (IllegalArgumentException success) {}
722      }
# Line 726 | Line 726 | public class ThreadPoolExecutorSubclassT
726       */
727      public void testConstructorNullPointerException4() {
728          try {
729 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null,new NoOpREHandler());
729 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new NoOpREHandler());
730              shouldThrow();
731          } catch (NullPointerException success) {}
732      }
# Line 737 | Line 737 | public class ThreadPoolExecutorSubclassT
737      public void testConstructorNullPointerException5() {
738          try {
739              RejectedExecutionHandler r = null;
740 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),r);
740 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),r);
741              shouldThrow();
742          } catch (NullPointerException success) {}
743      }
# Line 748 | Line 748 | public class ThreadPoolExecutorSubclassT
748       */
749      public void testConstructor16() {
750          try {
751 <            new CustomTPE(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
751 >            new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
752              shouldThrow();
753          } catch (IllegalArgumentException success) {}
754      }
# Line 758 | Line 758 | public class ThreadPoolExecutorSubclassT
758       */
759      public void testConstructor17() {
760          try {
761 <            new CustomTPE(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
761 >            new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
762              shouldThrow();
763          } catch (IllegalArgumentException success) {}
764      }
# Line 768 | Line 768 | public class ThreadPoolExecutorSubclassT
768       */
769      public void testConstructor18() {
770          try {
771 <            new CustomTPE(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
771 >            new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
772              shouldThrow();
773          } catch (IllegalArgumentException success) {}
774      }
# Line 778 | Line 778 | public class ThreadPoolExecutorSubclassT
778       */
779      public void testConstructor19() {
780          try {
781 <            new CustomTPE(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
781 >            new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
782              shouldThrow();
783          } catch (IllegalArgumentException success) {}
784      }
# Line 788 | Line 788 | public class ThreadPoolExecutorSubclassT
788       */
789      public void testConstructor20() {
790          try {
791 <            new CustomTPE(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
791 >            new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
792              shouldThrow();
793          } catch (IllegalArgumentException success) {}
794      }
795  
796      /**
797 <     * Constructor throws if workQueue is set to null
797 >     * Constructor throws if workQueue is null
798       */
799      public void testConstructorNullPointerException6() {
800          try {
801 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null,new SimpleThreadFactory(),new NoOpREHandler());
801 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new SimpleThreadFactory(),new NoOpREHandler());
802              shouldThrow();
803          } catch (NullPointerException success) {}
804      }
805  
806      /**
807 <     * Constructor throws if handler is set to null
807 >     * Constructor throws if handler is null
808       */
809      public void testConstructorNullPointerException7() {
810          try {
811              RejectedExecutionHandler r = null;
812 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),r);
812 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),r);
813              shouldThrow();
814          } catch (NullPointerException success) {}
815      }
816  
817      /**
818 <     * Constructor throws if ThreadFactory is set top null
818 >     * Constructor throws if ThreadFactory is null
819       */
820      public void testConstructorNullPointerException8() {
821          try {
822              ThreadFactory f = null;
823 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f,new NoOpREHandler());
823 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f,new NoOpREHandler());
824              shouldThrow();
825          } catch (NullPointerException success) {}
826      }
827  
828  
829      /**
830 <     *  execute throws RejectedExecutionException
831 <     *  if saturated.
830 >     * execute throws RejectedExecutionException if saturated.
831       */
832      public void testSaturatedExecute() {
833 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1));
833 >        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1));
834          try {
835  
836              for (int i = 0; i < 5; ++i) {
# Line 843 | Line 842 | public class ThreadPoolExecutorSubclassT
842      }
843  
844      /**
845 <     *  executor using CallerRunsPolicy runs task if saturated.
845 >     * executor using CallerRunsPolicy runs task if saturated.
846       */
847      public void testSaturatedExecute2() {
848          RejectedExecutionHandler h = new CustomTPE.CallerRunsPolicy();
849 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
849 >        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
850          try {
851  
852              TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5];
# Line 869 | Line 868 | public class ThreadPoolExecutorSubclassT
868      }
869  
870      /**
871 <     *  executor using DiscardPolicy drops task if saturated.
871 >     * executor using DiscardPolicy drops task if saturated.
872       */
873      public void testSaturatedExecute3() {
874          RejectedExecutionHandler h = new CustomTPE.DiscardPolicy();
875 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
875 >        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
876          try {
877  
878              TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5];
# Line 894 | Line 893 | public class ThreadPoolExecutorSubclassT
893      }
894  
895      /**
896 <     *  executor using DiscardOldestPolicy drops oldest task if saturated.
896 >     * executor using DiscardOldestPolicy drops oldest task if saturated.
897       */
898      public void testSaturatedExecute4() {
899          RejectedExecutionHandler h = new CustomTPE.DiscardOldestPolicy();
900 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
900 >        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
901          try {
902              p.execute(new TrackedLongRunnable());
903              TrackedLongRunnable r2 = new TrackedLongRunnable();
# Line 915 | Line 914 | public class ThreadPoolExecutorSubclassT
914      }
915  
916      /**
917 <     *  execute throws RejectedExecutionException if shutdown
917 >     * execute throws RejectedExecutionException if shutdown
918       */
919      public void testRejectedExecutionExceptionOnShutdown() {
920          ThreadPoolExecutor tpe =
921 <            new CustomTPE(1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(1));
921 >            new CustomTPE(1,1,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(1));
922          try { tpe.shutdown(); } catch (SecurityException ok) { return; }
923 <        try {
924 <            tpe.execute(new NoOpRunnable());
925 <            shouldThrow();
926 <        } catch (RejectedExecutionException success) {}
923 >        try {
924 >            tpe.execute(new NoOpRunnable());
925 >            shouldThrow();
926 >        } catch (RejectedExecutionException success) {}
927  
928 <        joinPool(tpe);
928 >        joinPool(tpe);
929      }
930  
931      /**
932 <     *  execute using CallerRunsPolicy drops task on shutdown
932 >     * execute using CallerRunsPolicy drops task on shutdown
933       */
934      public void testCallerRunsOnShutdown() {
935          RejectedExecutionHandler h = new CustomTPE.CallerRunsPolicy();
936 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
936 >        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
937  
938          try { p.shutdown(); } catch (SecurityException ok) { return; }
939 <        try {
939 >        try {
940              TrackedNoOpRunnable r = new TrackedNoOpRunnable();
941 <            p.execute(r);
941 >            p.execute(r);
942              assertFalse(r.done);
943          } finally {
944              joinPool(p);
# Line 947 | Line 946 | public class ThreadPoolExecutorSubclassT
946      }
947  
948      /**
949 <     *  execute using DiscardPolicy drops task on shutdown
949 >     * execute using DiscardPolicy drops task on shutdown
950       */
951      public void testDiscardOnShutdown() {
952          RejectedExecutionHandler h = new CustomTPE.DiscardPolicy();
953 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
953 >        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
954  
955          try { p.shutdown(); } catch (SecurityException ok) { return; }
956 <        try {
956 >        try {
957              TrackedNoOpRunnable r = new TrackedNoOpRunnable();
958 <            p.execute(r);
958 >            p.execute(r);
959              assertFalse(r.done);
960          } finally {
961              joinPool(p);
# Line 965 | Line 964 | public class ThreadPoolExecutorSubclassT
964  
965  
966      /**
967 <     *  execute using DiscardOldestPolicy drops task on shutdown
967 >     * execute using DiscardOldestPolicy drops task on shutdown
968       */
969      public void testDiscardOldestOnShutdown() {
970          RejectedExecutionHandler h = new CustomTPE.DiscardOldestPolicy();
971 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
971 >        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
972  
973          try { p.shutdown(); } catch (SecurityException ok) { return; }
974 <        try {
974 >        try {
975              TrackedNoOpRunnable r = new TrackedNoOpRunnable();
976 <            p.execute(r);
976 >            p.execute(r);
977              assertFalse(r.done);
978          } finally {
979              joinPool(p);
# Line 983 | Line 982 | public class ThreadPoolExecutorSubclassT
982  
983  
984      /**
985 <     *  execute (null) throws NPE
985 >     * execute(null) throws NPE
986       */
987      public void testExecuteNull() {
988          ThreadPoolExecutor tpe = null;
989          try {
990 <            tpe = new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
991 <            tpe.execute(null);
990 >            tpe = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
991 >            tpe.execute(null);
992              shouldThrow();
993 <        } catch (NullPointerException success) {}
993 >        } catch (NullPointerException success) {}
994  
995 <        joinPool(tpe);
995 >        joinPool(tpe);
996      }
997  
998      /**
999 <     *  setCorePoolSize of negative value throws IllegalArgumentException
999 >     * setCorePoolSize of negative value throws IllegalArgumentException
1000       */
1001      public void testCorePoolSizeIllegalArgumentException() {
1002 <        ThreadPoolExecutor tpe =
1003 <            new CustomTPE(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1004 <        try {
1005 <            tpe.setCorePoolSize(-1);
1006 <            shouldThrow();
1007 <        } catch (IllegalArgumentException success) {
1002 >        ThreadPoolExecutor tpe =
1003 >            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1004 >        try {
1005 >            tpe.setCorePoolSize(-1);
1006 >            shouldThrow();
1007 >        } catch (IllegalArgumentException success) {
1008          } finally {
1009              try { tpe.shutdown(); } catch (SecurityException ok) { return; }
1010          }
# Line 1013 | Line 1012 | public class ThreadPoolExecutorSubclassT
1012      }
1013  
1014      /**
1015 <     *  setMaximumPoolSize(int) throws IllegalArgumentException if
1016 <     *  given a value less the core pool size
1015 >     * setMaximumPoolSize(int) throws IllegalArgumentException
1016 >     * if given a value less the core pool size
1017       */
1018      public void testMaximumPoolSizeIllegalArgumentException() {
1019 <        ThreadPoolExecutor tpe = null;
1020 <        try {
1022 <            tpe = new CustomTPE(2,3,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1023 <        } catch (Exception e) {}
1019 >        ThreadPoolExecutor tpe =
1020 >            new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1021          try {
1022              tpe.setMaximumPoolSize(1);
1023              shouldThrow();
# Line 1032 | Line 1029 | public class ThreadPoolExecutorSubclassT
1029      }
1030  
1031      /**
1032 <     *  setMaximumPoolSize throws IllegalArgumentException
1033 <     *  if given a negative value
1032 >     * setMaximumPoolSize throws IllegalArgumentException
1033 >     * if given a negative value
1034       */
1035      public void testMaximumPoolSizeIllegalArgumentException2() {
1036 <        ThreadPoolExecutor tpe = null;
1037 <        try {
1041 <            tpe = new CustomTPE(2,3,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1042 <        } catch (Exception e) {}
1036 >        ThreadPoolExecutor tpe =
1037 >            new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1038          try {
1039              tpe.setMaximumPoolSize(-1);
1040              shouldThrow();
# Line 1052 | Line 1047 | public class ThreadPoolExecutorSubclassT
1047  
1048  
1049      /**
1050 <     *  setKeepAliveTime  throws IllegalArgumentException
1051 <     *  when given a negative value
1050 >     * setKeepAliveTime throws IllegalArgumentException
1051 >     * when given a negative value
1052       */
1053      public void testKeepAliveTimeIllegalArgumentException() {
1054 <        ThreadPoolExecutor tpe = null;
1055 <        try {
1061 <            tpe = new CustomTPE(2,3,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1062 <        } catch (Exception e) {}
1054 >        ThreadPoolExecutor tpe =
1055 >            new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1056  
1057 <        try {
1058 <            tpe.setKeepAliveTime(-1,TimeUnit.MILLISECONDS);
1057 >        try {
1058 >            tpe.setKeepAliveTime(-1,MILLISECONDS);
1059              shouldThrow();
1060          } catch (IllegalArgumentException success) {
1061          } finally {
# Line 1103 | Line 1096 | public class ThreadPoolExecutorSubclassT
1096       * completed submit of callable returns result
1097       */
1098      public void testSubmitCallable() throws Exception {
1099 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1099 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1100          try {
1101              Future<String> future = e.submit(new StringTask());
1102              String result = future.get();
# Line 1117 | Line 1110 | public class ThreadPoolExecutorSubclassT
1110       * completed submit of runnable returns successfully
1111       */
1112      public void testSubmitRunnable() throws Exception {
1113 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1113 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1114          try {
1115              Future<?> future = e.submit(new NoOpRunnable());
1116              future.get();
# Line 1131 | Line 1124 | public class ThreadPoolExecutorSubclassT
1124       * completed submit of (runnable, result) returns result
1125       */
1126      public void testSubmitRunnable2() throws Exception {
1127 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1127 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1128          try {
1129              Future<String> future = e.submit(new NoOpRunnable(), TEST_STRING);
1130              String result = future.get();
# Line 1146 | Line 1139 | public class ThreadPoolExecutorSubclassT
1139       * invokeAny(null) throws NPE
1140       */
1141      public void testInvokeAny1() throws Exception {
1142 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1142 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1143          try {
1144              e.invokeAny(null);
1145              shouldThrow();
# Line 1160 | Line 1153 | public class ThreadPoolExecutorSubclassT
1153       * invokeAny(empty collection) throws IAE
1154       */
1155      public void testInvokeAny2() throws Exception {
1156 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1156 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1157          try {
1158              e.invokeAny(new ArrayList<Callable<String>>());
1159              shouldThrow();
# Line 1174 | Line 1167 | public class ThreadPoolExecutorSubclassT
1167       * invokeAny(c) throws NPE if c has null elements
1168       */
1169      public void testInvokeAny3() throws Exception {
1170 <        final CountDownLatch latch = new CountDownLatch(1);
1171 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1170 >        CountDownLatch latch = new CountDownLatch(1);
1171 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1172 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1173 >        l.add(latchAwaitingStringTask(latch));
1174 >        l.add(null);
1175          try {
1180            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1181            l.add(new Callable<String>() {
1182                      public String call() {
1183                          try {
1184                              latch.await();
1185                          } catch (InterruptedException ok) {}
1186                          return TEST_STRING;
1187                      }});
1188            l.add(null);
1176              e.invokeAny(l);
1177              shouldThrow();
1178          } catch (NullPointerException success) {
# Line 1199 | Line 1186 | public class ThreadPoolExecutorSubclassT
1186       * invokeAny(c) throws ExecutionException if no task completes
1187       */
1188      public void testInvokeAny4() throws Exception {
1189 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1189 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1190 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1191 >        l.add(new NPETask());
1192          try {
1204            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1205            l.add(new NPETask());
1193              e.invokeAny(l);
1194              shouldThrow();
1195          } catch (ExecutionException success) {
1196 +            assertTrue(success.getCause() instanceof NullPointerException);
1197          } finally {
1198              joinPool(e);
1199          }
# Line 1215 | Line 1203 | public class ThreadPoolExecutorSubclassT
1203       * invokeAny(c) returns result of some task
1204       */
1205      public void testInvokeAny5() throws Exception {
1206 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1206 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1207          try {
1208 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1208 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1209              l.add(new StringTask());
1210              l.add(new StringTask());
1211              String result = e.invokeAny(l);
# Line 1231 | Line 1219 | public class ThreadPoolExecutorSubclassT
1219       * invokeAll(null) throws NPE
1220       */
1221      public void testInvokeAll1() throws Exception {
1222 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1222 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1223          try {
1224              e.invokeAll(null);
1225              shouldThrow();
# Line 1245 | Line 1233 | public class ThreadPoolExecutorSubclassT
1233       * invokeAll(empty collection) returns empty collection
1234       */
1235      public void testInvokeAll2() throws Exception {
1236 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1236 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1237          try {
1238              List<Future<String>> r = e.invokeAll(new ArrayList<Callable<String>>());
1239              assertTrue(r.isEmpty());
# Line 1258 | Line 1246 | public class ThreadPoolExecutorSubclassT
1246       * invokeAll(c) throws NPE if c has null elements
1247       */
1248      public void testInvokeAll3() throws Exception {
1249 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1249 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1250 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1251 >        l.add(new StringTask());
1252 >        l.add(null);
1253          try {
1263            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1264            l.add(new StringTask());
1265            l.add(null);
1254              e.invokeAll(l);
1255              shouldThrow();
1256          } catch (NullPointerException success) {
# Line 1275 | Line 1263 | public class ThreadPoolExecutorSubclassT
1263       * get of element of invokeAll(c) throws exception on failed task
1264       */
1265      public void testInvokeAll4() throws Exception {
1266 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1266 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1267 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1268 >        l.add(new NPETask());
1269 >        List<Future<String>> futures = e.invokeAll(l);
1270 >        assertEquals(1, futures.size());
1271          try {
1272 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1281 <            l.add(new NPETask());
1282 <            List<Future<String>> result = e.invokeAll(l);
1283 <            assertEquals(1, result.size());
1284 <            for (Future<String> future : result)
1285 <                future.get();
1272 >            futures.get(0).get();
1273              shouldThrow();
1274          } catch (ExecutionException success) {
1275 +            assertTrue(success.getCause() instanceof NullPointerException);
1276          } finally {
1277              joinPool(e);
1278          }
# Line 1294 | Line 1282 | public class ThreadPoolExecutorSubclassT
1282       * invokeAll(c) returns results of all completed tasks
1283       */
1284      public void testInvokeAll5() throws Exception {
1285 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1285 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1286          try {
1287 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1287 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1288              l.add(new StringTask());
1289              l.add(new StringTask());
1290 <            List<Future<String>> result = e.invokeAll(l);
1291 <            assertEquals(2, result.size());
1292 <            for (Future<String> future : result)
1290 >            List<Future<String>> futures = e.invokeAll(l);
1291 >            assertEquals(2, futures.size());
1292 >            for (Future<String> future : futures)
1293                  assertSame(TEST_STRING, future.get());
1294          } finally {
1295              joinPool(e);
# Line 1314 | Line 1302 | public class ThreadPoolExecutorSubclassT
1302       * timed invokeAny(null) throws NPE
1303       */
1304      public void testTimedInvokeAny1() throws Exception {
1305 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1305 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1306          try {
1307 <            e.invokeAny(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1307 >            e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS);
1308              shouldThrow();
1309          } catch (NullPointerException success) {
1310          } finally {
# Line 1328 | Line 1316 | public class ThreadPoolExecutorSubclassT
1316       * timed invokeAny(,,null) throws NPE
1317       */
1318      public void testTimedInvokeAnyNullTimeUnit() throws Exception {
1319 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1319 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1320 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1321 >        l.add(new StringTask());
1322          try {
1333            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1334            l.add(new StringTask());
1323              e.invokeAny(l, MEDIUM_DELAY_MS, null);
1324              shouldThrow();
1325          } catch (NullPointerException success) {
# Line 1344 | Line 1332 | public class ThreadPoolExecutorSubclassT
1332       * timed invokeAny(empty collection) throws IAE
1333       */
1334      public void testTimedInvokeAny2() throws Exception {
1335 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1335 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1336          try {
1337 <            e.invokeAny(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1337 >            e.invokeAny(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, MILLISECONDS);
1338              shouldThrow();
1339          } catch (IllegalArgumentException success) {
1340          } finally {
# Line 1358 | Line 1346 | public class ThreadPoolExecutorSubclassT
1346       * timed invokeAny(c) throws NPE if c has null elements
1347       */
1348      public void testTimedInvokeAny3() throws Exception {
1349 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1349 >        CountDownLatch latch = new CountDownLatch(1);
1350 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1351 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1352 >        l.add(latchAwaitingStringTask(latch));
1353 >        l.add(null);
1354          try {
1355 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1364 <            l.add(new StringTask());
1365 <            l.add(null);
1366 <            e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1355 >            e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1356              shouldThrow();
1357          } catch (NullPointerException success) {
1358          } finally {
1359 +            latch.countDown();
1360              joinPool(e);
1361          }
1362      }
# Line 1375 | Line 1365 | public class ThreadPoolExecutorSubclassT
1365       * timed invokeAny(c) throws ExecutionException if no task completes
1366       */
1367      public void testTimedInvokeAny4() throws Exception {
1368 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1368 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1369 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1370 >        l.add(new NPETask());
1371          try {
1372 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1381 <            l.add(new NPETask());
1382 <            e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1372 >            e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1373              shouldThrow();
1374          } catch (ExecutionException success) {
1375 +            assertTrue(success.getCause() instanceof NullPointerException);
1376          } finally {
1377              joinPool(e);
1378          }
# Line 1391 | Line 1382 | public class ThreadPoolExecutorSubclassT
1382       * timed invokeAny(c) returns result of some task
1383       */
1384      public void testTimedInvokeAny5() throws Exception {
1385 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1385 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1386          try {
1387 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1387 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1388              l.add(new StringTask());
1389              l.add(new StringTask());
1390 <            String result = e.invokeAny(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1390 >            String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1391              assertSame(TEST_STRING, result);
1392          } finally {
1393              joinPool(e);
# Line 1407 | Line 1398 | public class ThreadPoolExecutorSubclassT
1398       * timed invokeAll(null) throws NPE
1399       */
1400      public void testTimedInvokeAll1() throws Exception {
1401 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1401 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1402          try {
1403 <            e.invokeAll(null, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1403 >            e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS);
1404              shouldThrow();
1405          } catch (NullPointerException success) {
1406          } finally {
# Line 1421 | Line 1412 | public class ThreadPoolExecutorSubclassT
1412       * timed invokeAll(,,null) throws NPE
1413       */
1414      public void testTimedInvokeAllNullTimeUnit() throws Exception {
1415 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1415 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1416 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1417 >        l.add(new StringTask());
1418          try {
1426            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1427            l.add(new StringTask());
1419              e.invokeAll(l, MEDIUM_DELAY_MS, null);
1420              shouldThrow();
1421          } catch (NullPointerException success) {
# Line 1437 | Line 1428 | public class ThreadPoolExecutorSubclassT
1428       * timed invokeAll(empty collection) returns empty collection
1429       */
1430      public void testTimedInvokeAll2() throws Exception {
1431 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1431 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1432          try {
1433 <            List<Future<String>> r = e.invokeAll(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1433 >            List<Future<String>> r = e.invokeAll(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, MILLISECONDS);
1434              assertTrue(r.isEmpty());
1435          } finally {
1436              joinPool(e);
# Line 1450 | Line 1441 | public class ThreadPoolExecutorSubclassT
1441       * timed invokeAll(c) throws NPE if c has null elements
1442       */
1443      public void testTimedInvokeAll3() throws Exception {
1444 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1444 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1445 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1446 >        l.add(new StringTask());
1447 >        l.add(null);
1448          try {
1449 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1456 <            l.add(new StringTask());
1457 <            l.add(null);
1458 <            e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1449 >            e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1450              shouldThrow();
1451          } catch (NullPointerException success) {
1452          } finally {
# Line 1467 | Line 1458 | public class ThreadPoolExecutorSubclassT
1458       * get of element of invokeAll(c) throws exception on failed task
1459       */
1460      public void testTimedInvokeAll4() throws Exception {
1461 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1461 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1462 >        List<Callable<String>> l = new ArrayList<Callable<String>>();
1463 >        l.add(new NPETask());
1464 >        List<Future<String>> futures =
1465 >            e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1466 >        assertEquals(1, futures.size());
1467          try {
1468 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1473 <            l.add(new NPETask());
1474 <            List<Future<String>> result = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1475 <            assertEquals(1, result.size());
1476 <            for (Future<String> future : result)
1477 <                future.get();
1468 >            futures.get(0).get();
1469              shouldThrow();
1470          } catch (ExecutionException success) {
1471              assertTrue(success.getCause() instanceof NullPointerException);
# Line 1487 | Line 1478 | public class ThreadPoolExecutorSubclassT
1478       * timed invokeAll(c) returns results of all completed tasks
1479       */
1480      public void testTimedInvokeAll5() throws Exception {
1481 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1481 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1482          try {
1483 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1483 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1484              l.add(new StringTask());
1485              l.add(new StringTask());
1486 <            List<Future<String>> result = e.invokeAll(l, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
1487 <            assertEquals(2, result.size());
1488 <            for (Future<String> future : result)
1486 >            List<Future<String>> futures =
1487 >                e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1488 >            assertEquals(2, futures.size());
1489 >            for (Future<String> future : futures)
1490                  assertSame(TEST_STRING, future.get());
1499        } catch (ExecutionException success) {
1491          } finally {
1492              joinPool(e);
1493          }
# Line 1506 | Line 1497 | public class ThreadPoolExecutorSubclassT
1497       * timed invokeAll(c) cancels tasks not completed by timeout
1498       */
1499      public void testTimedInvokeAll6() throws Exception {
1500 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1500 >        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1501          try {
1502 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1502 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1503              l.add(new StringTask());
1504              l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING));
1505              l.add(new StringTask());
1506 <            List<Future<String>> result = e.invokeAll(l, SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
1507 <            assertEquals(3, result.size());
1508 <            Iterator<Future<String>> it = result.iterator();
1506 >            List<Future<String>> futures =
1507 >                e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS);
1508 >            assertEquals(3, futures.size());
1509 >            Iterator<Future<String>> it = futures.iterator();
1510              Future<String> f1 = it.next();
1511              Future<String> f2 = it.next();
1512              Future<String> f3 = it.next();
# Line 1533 | Line 1525 | public class ThreadPoolExecutorSubclassT
1525       * thread factory fails to create more
1526       */
1527      public void testFailingThreadFactory() throws InterruptedException {
1528 <        ExecutorService e = new CustomTPE(100, 100, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), new FailingThreadFactory());
1528 >        ExecutorService e = new CustomTPE(100, 100, LONG_DELAY_MS, MILLISECONDS, new LinkedBlockingQueue<Runnable>(), new FailingThreadFactory());
1529          try {
1530              for (int k = 0; k < 100; ++k) {
1531                  e.execute(new NoOpRunnable());
# Line 1548 | Line 1540 | public class ThreadPoolExecutorSubclassT
1540       * allowsCoreThreadTimeOut is by default false.
1541       */
1542      public void testAllowsCoreThreadTimeOut() {
1543 <        ThreadPoolExecutor tpe = new CustomTPE(2, 2, 1000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1543 >        ThreadPoolExecutor tpe = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1544          assertFalse(tpe.allowsCoreThreadTimeOut());
1545          joinPool(tpe);
1546      }
# Line 1557 | Line 1549 | public class ThreadPoolExecutorSubclassT
1549       * allowCoreThreadTimeOut(true) causes idle threads to time out
1550       */
1551      public void testAllowCoreThreadTimeOut_true() throws InterruptedException {
1552 <        ThreadPoolExecutor tpe = new CustomTPE(2, 10, 10, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1552 >        ThreadPoolExecutor tpe = new CustomTPE(2, 10, 10, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1553          tpe.allowCoreThreadTimeOut(true);
1554          tpe.execute(new NoOpRunnable());
1555          try {
# Line 1572 | Line 1564 | public class ThreadPoolExecutorSubclassT
1564       * allowCoreThreadTimeOut(false) causes idle threads not to time out
1565       */
1566      public void testAllowCoreThreadTimeOut_false() throws InterruptedException {
1567 <        ThreadPoolExecutor tpe = new CustomTPE(2, 10, 10, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1567 >        ThreadPoolExecutor tpe = new CustomTPE(2, 10, 10, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1568          tpe.allowCoreThreadTimeOut(false);
1569          tpe.execute(new NoOpRunnable());
1570          try {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines