37 |
|
} |
38 |
|
} |
39 |
|
|
40 |
< |
static class FailingThreadFactory implements ThreadFactory{ |
40 |
> |
static class FailingThreadFactory implements ThreadFactory { |
41 |
|
int calls = 0; |
42 |
< |
public Thread newThread(Runnable r){ |
42 |
> |
public Thread newThread(Runnable r) { |
43 |
|
if (++calls > 1) return null; |
44 |
|
return new Thread(r); |
45 |
|
} |
56 |
|
public void run() { |
57 |
|
try { |
58 |
|
Thread.sleep(SHORT_DELAY_MS); |
59 |
< |
} catch (InterruptedException e){ |
59 |
> |
} catch (InterruptedException e) { |
60 |
|
threadUnexpectedException(); |
61 |
|
} |
62 |
|
} |
63 |
|
}); |
64 |
|
Thread.sleep(SMALL_DELAY_MS); |
65 |
< |
} catch (InterruptedException e){ |
65 |
> |
} catch (InterruptedException e) { |
66 |
|
unexpectedException(); |
67 |
|
} |
68 |
|
joinPool(p1); |
78 |
|
p2.execute(new MediumRunnable()); |
79 |
|
try { |
80 |
|
Thread.sleep(SHORT_DELAY_MS); |
81 |
< |
} catch (Exception e){ |
81 |
> |
} catch (Exception e) { |
82 |
|
unexpectedException(); |
83 |
|
} |
84 |
|
assertEquals(1, p2.getActiveCount()); |
123 |
|
p2.execute(new ShortRunnable()); |
124 |
|
try { |
125 |
|
Thread.sleep(SMALL_DELAY_MS); |
126 |
< |
} catch (Exception e){ |
126 |
> |
} catch (Exception e) { |
127 |
|
unexpectedException(); |
128 |
|
} |
129 |
|
assertEquals(1, p2.getCompletedTaskCount()); |
236 |
|
p2.execute(new MediumRunnable()); |
237 |
|
Thread.sleep(SHORT_DELAY_MS); |
238 |
|
assertEquals(2, p2.getLargestPoolSize()); |
239 |
< |
} catch (Exception e){ |
239 |
> |
} catch (Exception e) { |
240 |
|
unexpectedException(); |
241 |
|
} |
242 |
|
joinPool(p2); |
274 |
|
p1.execute(new MediumRunnable()); |
275 |
|
Thread.sleep(SHORT_DELAY_MS); |
276 |
|
assertEquals(1, p1.getTaskCount()); |
277 |
< |
} catch (Exception e){ |
277 |
> |
} catch (Exception e) { |
278 |
|
unexpectedException(); |
279 |
|
} |
280 |
|
joinPool(p1); |
307 |
|
try { |
308 |
|
assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS)); |
309 |
|
assertTrue(p1.isTerminated()); |
310 |
< |
} catch (Exception e){ |
310 |
> |
} catch (Exception e) { |
311 |
|
unexpectedException(); |
312 |
|
} |
313 |
|
} |
328 |
|
assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS)); |
329 |
|
assertTrue(p1.isTerminated()); |
330 |
|
assertFalse(p1.isTerminating()); |
331 |
< |
} catch (Exception e){ |
331 |
> |
} catch (Exception e) { |
332 |
|
unexpectedException(); |
333 |
|
} |
334 |
|
} |
340 |
|
BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10); |
341 |
|
ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, q); |
342 |
|
FutureTask[] tasks = new FutureTask[5]; |
343 |
< |
for (int i = 0; i < 5; i++){ |
343 |
> |
for (int i = 0; i < 5; i++) { |
344 |
|
tasks[i] = new FutureTask(new MediumPossiblyInterruptedRunnable(), Boolean.TRUE); |
345 |
|
p1.execute(tasks[i]); |
346 |
|
} |
367 |
|
BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10); |
368 |
|
ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, q); |
369 |
|
FutureTask[] tasks = new FutureTask[5]; |
370 |
< |
for (int i = 0; i < 5; i++){ |
370 |
> |
for (int i = 0; i < 5; i++) { |
371 |
|
tasks[i] = new FutureTask(new MediumPossiblyInterruptedRunnable(), Boolean.TRUE); |
372 |
|
p1.execute(tasks[i]); |
373 |
|
} |
395 |
|
public void testPurge() { |
396 |
|
ThreadPoolExecutor p1 = new ThreadPoolExecutor(1, 1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
397 |
|
FutureTask[] tasks = new FutureTask[5]; |
398 |
< |
for (int i = 0; i < 5; i++){ |
398 |
> |
for (int i = 0; i < 5; i++) { |
399 |
|
tasks[i] = new FutureTask(new MediumPossiblyInterruptedRunnable(), Boolean.TRUE); |
400 |
|
p1.execute(tasks[i]); |
401 |
|
} |
438 |
|
new ThreadPoolExecutor(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
439 |
|
shouldThrow(); |
440 |
|
} |
441 |
< |
catch (IllegalArgumentException success){} |
441 |
> |
catch (IllegalArgumentException success) {} |
442 |
|
} |
443 |
|
|
444 |
|
/** |
449 |
|
new ThreadPoolExecutor(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
450 |
|
shouldThrow(); |
451 |
|
} |
452 |
< |
catch (IllegalArgumentException success){} |
452 |
> |
catch (IllegalArgumentException success) {} |
453 |
|
} |
454 |
|
|
455 |
|
/** |
460 |
|
new ThreadPoolExecutor(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
461 |
|
shouldThrow(); |
462 |
|
} |
463 |
< |
catch (IllegalArgumentException success){} |
463 |
> |
catch (IllegalArgumentException success) {} |
464 |
|
} |
465 |
|
|
466 |
|
/** |
471 |
|
new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
472 |
|
shouldThrow(); |
473 |
|
} |
474 |
< |
catch (IllegalArgumentException success){} |
474 |
> |
catch (IllegalArgumentException success) {} |
475 |
|
} |
476 |
|
|
477 |
|
/** |
482 |
|
new ThreadPoolExecutor(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
483 |
|
shouldThrow(); |
484 |
|
} |
485 |
< |
catch (IllegalArgumentException success){} |
485 |
> |
catch (IllegalArgumentException success) {} |
486 |
|
} |
487 |
|
|
488 |
|
/** |
493 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null); |
494 |
|
shouldThrow(); |
495 |
|
} |
496 |
< |
catch (NullPointerException success){} |
496 |
> |
catch (NullPointerException success) {} |
497 |
|
} |
498 |
|
|
499 |
|
|
505 |
|
try { |
506 |
|
new ThreadPoolExecutor(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
507 |
|
shouldThrow(); |
508 |
< |
} catch (IllegalArgumentException success){} |
508 |
> |
} catch (IllegalArgumentException success) {} |
509 |
|
} |
510 |
|
|
511 |
|
/** |
516 |
|
new ThreadPoolExecutor(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
517 |
|
shouldThrow(); |
518 |
|
} |
519 |
< |
catch (IllegalArgumentException success){} |
519 |
> |
catch (IllegalArgumentException success) {} |
520 |
|
} |
521 |
|
|
522 |
|
/** |
527 |
|
new ThreadPoolExecutor(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
528 |
|
shouldThrow(); |
529 |
|
} |
530 |
< |
catch (IllegalArgumentException success){} |
530 |
> |
catch (IllegalArgumentException success) {} |
531 |
|
} |
532 |
|
|
533 |
|
/** |
538 |
|
new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
539 |
|
shouldThrow(); |
540 |
|
} |
541 |
< |
catch (IllegalArgumentException success){} |
541 |
> |
catch (IllegalArgumentException success) {} |
542 |
|
} |
543 |
|
|
544 |
|
/** |
549 |
|
new ThreadPoolExecutor(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
550 |
|
shouldThrow(); |
551 |
|
} |
552 |
< |
catch (IllegalArgumentException success){} |
552 |
> |
catch (IllegalArgumentException success) {} |
553 |
|
} |
554 |
|
|
555 |
|
/** |
560 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null,new SimpleThreadFactory()); |
561 |
|
shouldThrow(); |
562 |
|
} |
563 |
< |
catch (NullPointerException success){} |
563 |
> |
catch (NullPointerException success) {} |
564 |
|
} |
565 |
|
|
566 |
|
/** |
572 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f); |
573 |
|
shouldThrow(); |
574 |
|
} |
575 |
< |
catch (NullPointerException success){} |
575 |
> |
catch (NullPointerException success) {} |
576 |
|
} |
577 |
|
|
578 |
|
|
584 |
|
new ThreadPoolExecutor(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
585 |
|
shouldThrow(); |
586 |
|
} |
587 |
< |
catch (IllegalArgumentException success){} |
587 |
> |
catch (IllegalArgumentException success) {} |
588 |
|
} |
589 |
|
|
590 |
|
/** |
595 |
|
new ThreadPoolExecutor(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
596 |
|
shouldThrow(); |
597 |
|
} |
598 |
< |
catch (IllegalArgumentException success){} |
598 |
> |
catch (IllegalArgumentException success) {} |
599 |
|
} |
600 |
|
|
601 |
|
/** |
606 |
|
new ThreadPoolExecutor(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
607 |
|
shouldThrow(); |
608 |
|
} |
609 |
< |
catch (IllegalArgumentException success){} |
609 |
> |
catch (IllegalArgumentException success) {} |
610 |
|
} |
611 |
|
|
612 |
|
/** |
617 |
|
new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
618 |
|
shouldThrow(); |
619 |
|
} |
620 |
< |
catch (IllegalArgumentException success){} |
620 |
> |
catch (IllegalArgumentException success) {} |
621 |
|
} |
622 |
|
|
623 |
|
/** |
628 |
|
new ThreadPoolExecutor(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
629 |
|
shouldThrow(); |
630 |
|
} |
631 |
< |
catch (IllegalArgumentException success){} |
631 |
> |
catch (IllegalArgumentException success) {} |
632 |
|
} |
633 |
|
|
634 |
|
/** |
639 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null,new NoOpREHandler()); |
640 |
|
shouldThrow(); |
641 |
|
} |
642 |
< |
catch (NullPointerException success){} |
642 |
> |
catch (NullPointerException success) {} |
643 |
|
} |
644 |
|
|
645 |
|
/** |
651 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),r); |
652 |
|
shouldThrow(); |
653 |
|
} |
654 |
< |
catch (NullPointerException success){} |
654 |
> |
catch (NullPointerException success) {} |
655 |
|
} |
656 |
|
|
657 |
|
|
663 |
|
new ThreadPoolExecutor(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
664 |
|
shouldThrow(); |
665 |
|
} |
666 |
< |
catch (IllegalArgumentException success){} |
666 |
> |
catch (IllegalArgumentException success) {} |
667 |
|
} |
668 |
|
|
669 |
|
/** |
674 |
|
new ThreadPoolExecutor(1,-1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
675 |
|
shouldThrow(); |
676 |
|
} |
677 |
< |
catch (IllegalArgumentException success){} |
677 |
> |
catch (IllegalArgumentException success) {} |
678 |
|
} |
679 |
|
|
680 |
|
/** |
685 |
|
new ThreadPoolExecutor(1,0,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
686 |
|
shouldThrow(); |
687 |
|
} |
688 |
< |
catch (IllegalArgumentException success){} |
688 |
> |
catch (IllegalArgumentException success) {} |
689 |
|
} |
690 |
|
|
691 |
|
/** |
696 |
|
new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
697 |
|
shouldThrow(); |
698 |
|
} |
699 |
< |
catch (IllegalArgumentException success){} |
699 |
> |
catch (IllegalArgumentException success) {} |
700 |
|
} |
701 |
|
|
702 |
|
/** |
707 |
|
new ThreadPoolExecutor(2,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
708 |
|
shouldThrow(); |
709 |
|
} |
710 |
< |
catch (IllegalArgumentException success){} |
710 |
> |
catch (IllegalArgumentException success) {} |
711 |
|
} |
712 |
|
|
713 |
|
/** |
718 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,null,new SimpleThreadFactory(),new NoOpREHandler()); |
719 |
|
shouldThrow(); |
720 |
|
} |
721 |
< |
catch (NullPointerException success){} |
721 |
> |
catch (NullPointerException success) {} |
722 |
|
} |
723 |
|
|
724 |
|
/** |
730 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),r); |
731 |
|
shouldThrow(); |
732 |
|
} |
733 |
< |
catch (NullPointerException success){} |
733 |
> |
catch (NullPointerException success) {} |
734 |
|
} |
735 |
|
|
736 |
|
/** |
742 |
|
new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f,new NoOpREHandler()); |
743 |
|
shouldThrow(); |
744 |
|
} |
745 |
< |
catch (NullPointerException successdn8){} |
745 |
> |
catch (NullPointerException successdn8) {} |
746 |
|
} |
747 |
|
|
748 |
|
|
754 |
|
ThreadPoolExecutor p = new ThreadPoolExecutor(1,1, LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1)); |
755 |
|
try { |
756 |
|
|
757 |
< |
for (int i = 0; i < 5; ++i){ |
757 |
> |
for (int i = 0; i < 5; ++i) { |
758 |
|
p.execute(new MediumRunnable()); |
759 |
|
} |
760 |
|
shouldThrow(); |
761 |
< |
} catch (RejectedExecutionException success){} |
761 |
> |
} catch (RejectedExecutionException success) {} |
762 |
|
joinPool(p); |
763 |
|
} |
764 |
|
|
771 |
|
try { |
772 |
|
|
773 |
|
TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5]; |
774 |
< |
for (int i = 0; i < 5; ++i){ |
774 |
> |
for (int i = 0; i < 5; ++i) { |
775 |
|
tasks[i] = new TrackedNoOpRunnable(); |
776 |
|
} |
777 |
|
TrackedLongRunnable mr = new TrackedLongRunnable(); |
778 |
|
p.execute(mr); |
779 |
< |
for (int i = 0; i < 5; ++i){ |
779 |
> |
for (int i = 0; i < 5; ++i) { |
780 |
|
p.execute(tasks[i]); |
781 |
|
} |
782 |
|
for (int i = 1; i < 5; ++i) { |
783 |
|
assertTrue(tasks[i].done); |
784 |
|
} |
785 |
|
try { p.shutdownNow(); } catch (SecurityException ok) { return; } |
786 |
< |
} catch (RejectedExecutionException ex){ |
786 |
> |
} catch (RejectedExecutionException ex) { |
787 |
|
unexpectedException(); |
788 |
|
} finally { |
789 |
|
joinPool(p); |
799 |
|
try { |
800 |
|
|
801 |
|
TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5]; |
802 |
< |
for (int i = 0; i < 5; ++i){ |
802 |
> |
for (int i = 0; i < 5; ++i) { |
803 |
|
tasks[i] = new TrackedNoOpRunnable(); |
804 |
|
} |
805 |
|
p.execute(new TrackedLongRunnable()); |
806 |
< |
for (int i = 0; i < 5; ++i){ |
806 |
> |
for (int i = 0; i < 5; ++i) { |
807 |
|
p.execute(tasks[i]); |
808 |
|
} |
809 |
< |
for (int i = 0; i < 5; ++i){ |
809 |
> |
for (int i = 0; i < 5; ++i) { |
810 |
|
assertFalse(tasks[i].done); |
811 |
|
} |
812 |
|
try { p.shutdownNow(); } catch (SecurityException ok) { return; } |
813 |
< |
} catch (RejectedExecutionException ex){ |
813 |
> |
} catch (RejectedExecutionException ex) { |
814 |
|
unexpectedException(); |
815 |
|
} finally { |
816 |
|
joinPool(p); |
833 |
|
assertFalse(p.getQueue().contains(r2)); |
834 |
|
assertTrue(p.getQueue().contains(r3)); |
835 |
|
try { p.shutdownNow(); } catch (SecurityException ok) { return; } |
836 |
< |
} catch (RejectedExecutionException ex){ |
836 |
> |
} catch (RejectedExecutionException ex) { |
837 |
|
unexpectedException(); |
838 |
|
} finally { |
839 |
|
joinPool(p); |
850 |
|
try { |
851 |
|
tpe.execute(new NoOpRunnable()); |
852 |
|
shouldThrow(); |
853 |
< |
} catch (RejectedExecutionException success){} |
853 |
> |
} catch (RejectedExecutionException success) {} |
854 |
|
|
855 |
|
joinPool(tpe); |
856 |
|
} |
867 |
|
TrackedNoOpRunnable r = new TrackedNoOpRunnable(); |
868 |
|
p.execute(r); |
869 |
|
assertFalse(r.done); |
870 |
< |
} catch (RejectedExecutionException success){ |
870 |
> |
} catch (RejectedExecutionException success) { |
871 |
|
unexpectedException(); |
872 |
|
} finally { |
873 |
|
joinPool(p); |
886 |
|
TrackedNoOpRunnable r = new TrackedNoOpRunnable(); |
887 |
|
p.execute(r); |
888 |
|
assertFalse(r.done); |
889 |
< |
} catch (RejectedExecutionException success){ |
889 |
> |
} catch (RejectedExecutionException success) { |
890 |
|
unexpectedException(); |
891 |
|
} finally { |
892 |
|
joinPool(p); |
906 |
|
TrackedNoOpRunnable r = new TrackedNoOpRunnable(); |
907 |
|
p.execute(r); |
908 |
|
assertFalse(r.done); |
909 |
< |
} catch (RejectedExecutionException success){ |
909 |
> |
} catch (RejectedExecutionException success) { |
910 |
|
unexpectedException(); |
911 |
|
} finally { |
912 |
|
joinPool(p); |
923 |
|
tpe = new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
924 |
|
tpe.execute(null); |
925 |
|
shouldThrow(); |
926 |
< |
} catch (NullPointerException success){} |
926 |
> |
} catch (NullPointerException success) {} |
927 |
|
|
928 |
|
joinPool(tpe); |
929 |
|
} |
935 |
|
ThreadPoolExecutor tpe = null; |
936 |
|
try { |
937 |
|
tpe = new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
938 |
< |
} catch (Exception e){} |
938 |
> |
} catch (Exception e) {} |
939 |
|
try { |
940 |
|
tpe.setCorePoolSize(-1); |
941 |
|
shouldThrow(); |
942 |
< |
} catch (IllegalArgumentException success){ |
942 |
> |
} catch (IllegalArgumentException success) { |
943 |
|
} finally { |
944 |
|
try { tpe.shutdown(); } catch (SecurityException ok) { return; } |
945 |
|
} |
954 |
|
ThreadPoolExecutor tpe = null; |
955 |
|
try { |
956 |
|
tpe = new ThreadPoolExecutor(2,3,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
957 |
< |
} catch (Exception e){} |
957 |
> |
} catch (Exception e) {} |
958 |
|
try { |
959 |
|
tpe.setMaximumPoolSize(1); |
960 |
|
shouldThrow(); |
961 |
< |
} catch (IllegalArgumentException success){ |
961 |
> |
} catch (IllegalArgumentException success) { |
962 |
|
} finally { |
963 |
|
try { tpe.shutdown(); } catch (SecurityException ok) { return; } |
964 |
|
} |
973 |
|
ThreadPoolExecutor tpe = null; |
974 |
|
try { |
975 |
|
tpe = new ThreadPoolExecutor(2,3,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
976 |
< |
} catch (Exception e){} |
976 |
> |
} catch (Exception e) {} |
977 |
|
try { |
978 |
|
tpe.setMaximumPoolSize(-1); |
979 |
|
shouldThrow(); |
980 |
< |
} catch (IllegalArgumentException success){ |
980 |
> |
} catch (IllegalArgumentException success) { |
981 |
|
} finally { |
982 |
|
try { tpe.shutdown(); } catch (SecurityException ok) { return; } |
983 |
|
} |
993 |
|
ThreadPoolExecutor tpe = null; |
994 |
|
try { |
995 |
|
tpe = new ThreadPoolExecutor(2,3,LONG_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
996 |
< |
} catch (Exception e){} |
996 |
> |
} catch (Exception e) {} |
997 |
|
|
998 |
|
try { |
999 |
|
tpe.setKeepAliveTime(-1,TimeUnit.MILLISECONDS); |
1000 |
|
shouldThrow(); |
1001 |
< |
} catch (IllegalArgumentException success){ |
1001 |
> |
} catch (IllegalArgumentException success) { |
1002 |
|
} finally { |
1003 |
|
try { tpe.shutdown(); } catch (SecurityException ok) { return; } |
1004 |
|
} |
1549 |
|
try { |
1550 |
|
Thread.sleep(MEDIUM_DELAY_MS); |
1551 |
|
assertEquals(0, tpe.getPoolSize()); |
1552 |
< |
} catch (InterruptedException e){ |
1552 |
> |
} catch (InterruptedException e) { |
1553 |
|
unexpectedException(); |
1554 |
|
} finally { |
1555 |
|
joinPool(tpe); |
1566 |
|
try { |
1567 |
|
Thread.sleep(MEDIUM_DELAY_MS); |
1568 |
|
assertTrue(tpe.getPoolSize() >= 1); |
1569 |
< |
} catch (InterruptedException e){ |
1569 |
> |
} catch (InterruptedException e) { |
1570 |
|
unexpectedException(); |
1571 |
|
} finally { |
1572 |
|
joinPool(tpe); |