563 |
|
q); |
564 |
|
try (PoolCleaner cleaner = cleaner(p, done)) { |
565 |
|
final CountDownLatch threadStarted = new CountDownLatch(1); |
566 |
< |
FutureTask[] tasks = new FutureTask[5]; |
566 |
> |
FutureTask[] rtasks = new FutureTask[5]; |
567 |
> |
@SuppressWarnings("unchecked") |
568 |
> |
FutureTask<Boolean>[] tasks = (FutureTask<Boolean>[])rtasks; |
569 |
|
for (int i = 0; i < tasks.length; i++) { |
570 |
< |
Callable task = new CheckedCallable<Boolean>() { |
570 |
> |
Callable<Boolean> task = new CheckedCallable<Boolean>() { |
571 |
|
public Boolean realCall() throws InterruptedException { |
572 |
|
threadStarted.countDown(); |
573 |
|
assertSame(q, p.getQueue()); |
574 |
|
await(done); |
575 |
|
return Boolean.TRUE; |
576 |
|
}}; |
577 |
< |
tasks[i] = new FutureTask(task); |
577 |
> |
tasks[i] = new FutureTask<Boolean>(task); |
578 |
|
p.execute(tasks[i]); |
579 |
|
} |
580 |
|
await(threadStarted); |
631 |
|
LONG_DELAY_MS, MILLISECONDS, |
632 |
|
q); |
633 |
|
try (PoolCleaner cleaner = cleaner(p, done)) { |
634 |
< |
FutureTask[] tasks = new FutureTask[5]; |
634 |
> |
FutureTask[] rtasks = new FutureTask[5]; |
635 |
> |
@SuppressWarnings("unchecked") |
636 |
> |
FutureTask<Boolean>[] tasks = (FutureTask<Boolean>[])rtasks; |
637 |
|
for (int i = 0; i < tasks.length; i++) { |
638 |
< |
Callable task = new CheckedCallable<Boolean>() { |
638 |
> |
Callable<Boolean> task = new CheckedCallable<Boolean>() { |
639 |
|
public Boolean realCall() throws InterruptedException { |
640 |
|
threadStarted.countDown(); |
641 |
|
await(done); |
642 |
|
return Boolean.TRUE; |
643 |
|
}}; |
644 |
< |
tasks[i] = new FutureTask(task); |
644 |
> |
tasks[i] = new FutureTask<Boolean>(task); |
645 |
|
p.execute(tasks[i]); |
646 |
|
} |
647 |
|
await(threadStarted); |
763 |
|
public void testConstructorNullPointerException() { |
764 |
|
try { |
765 |
|
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
766 |
< |
(BlockingQueue) null); |
766 |
> |
(BlockingQueue<Runnable>) null); |
767 |
|
shouldThrow(); |
768 |
|
} catch (NullPointerException success) {} |
769 |
|
} |
834 |
|
public void testConstructorNullPointerException2() { |
835 |
|
try { |
836 |
|
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
837 |
< |
(BlockingQueue) null, |
837 |
> |
(BlockingQueue<Runnable>) null, |
838 |
|
new SimpleThreadFactory()); |
839 |
|
shouldThrow(); |
840 |
|
} catch (NullPointerException success) {} |
918 |
|
public void testConstructorNullPointerException4() { |
919 |
|
try { |
920 |
|
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
921 |
< |
(BlockingQueue) null, |
921 |
> |
(BlockingQueue<Runnable>) null, |
922 |
|
new NoOpREHandler()); |
923 |
|
shouldThrow(); |
924 |
|
} catch (NullPointerException success) {} |
1007 |
|
public void testConstructorNullPointerException6() { |
1008 |
|
try { |
1009 |
|
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
1010 |
< |
(BlockingQueue) null, |
1010 |
> |
(BlockingQueue<Runnable>) null, |
1011 |
|
new SimpleThreadFactory(), |
1012 |
|
new NoOpREHandler()); |
1013 |
|
shouldThrow(); |
1054 |
|
final CountDownLatch threadStarted = new CountDownLatch(1); |
1055 |
|
Thread t = newStartedThread(new CheckedInterruptedRunnable() { |
1056 |
|
public void realRun() throws Exception { |
1057 |
< |
Callable task = new CheckedCallable<Boolean>() { |
1057 |
> |
Callable<Boolean> task = new CheckedCallable<Boolean>() { |
1058 |
|
public Boolean realCall() throws InterruptedException { |
1059 |
|
threadStarted.countDown(); |
1060 |
|
await(done); |
1793 |
|
p.invokeAll(tasks, timeout, MILLISECONDS); |
1794 |
|
assertEquals(tasks.size(), futures.size()); |
1795 |
|
assertTrue(millisElapsedSince(startTime) >= timeout); |
1796 |
< |
for (Future future : futures) |
1796 |
> |
for (Future<?> future : futures) |
1797 |
|
assertTrue(future.isDone()); |
1798 |
|
assertTrue(futures.get(1).isCancelled()); |
1799 |
|
try { |
1908 |
|
final ThreadPoolExecutor p = |
1909 |
|
new ThreadPoolExecutor(1, 30, |
1910 |
|
60, SECONDS, |
1911 |
< |
new ArrayBlockingQueue(30)); |
1911 |
> |
new ArrayBlockingQueue<Runnable>(30)); |
1912 |
|
try (PoolCleaner cleaner = cleaner(p)) { |
1913 |
|
for (int i = 0; i < nTasks; ++i) { |
1914 |
|
for (;;) { |