12 |
|
* @modules java.management |
13 |
|
* @build * |
14 |
|
* @run junit/othervm/timeout=1000 -Djsr166.testImplementationDetails=true JSR166TestCase |
15 |
+ |
* @run junit/othervm/timeout=1000 -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 -Djsr166.testImplementationDetails=true JSR166TestCase |
16 |
|
*/ |
17 |
|
|
18 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
59 |
|
import java.util.concurrent.RecursiveTask; |
60 |
|
import java.util.concurrent.RejectedExecutionHandler; |
61 |
|
import java.util.concurrent.Semaphore; |
62 |
+ |
import java.util.concurrent.SynchronousQueue; |
63 |
|
import java.util.concurrent.ThreadFactory; |
64 |
|
import java.util.concurrent.ThreadPoolExecutor; |
65 |
|
import java.util.concurrent.TimeoutException; |
513 |
|
"StampedLockTest", |
514 |
|
"SubmissionPublisherTest", |
515 |
|
"ThreadLocalRandom8Test", |
516 |
+ |
"TimeUnit8Test", |
517 |
|
}; |
518 |
|
addNamedTestClasses(suite, java8TestClassNames); |
519 |
|
} |
521 |
|
// Java9+ test classes |
522 |
|
if (atLeastJava9()) { |
523 |
|
String[] java9TestClassNames = { |
524 |
< |
// Currently empty, but expecting varhandle tests |
524 |
> |
"ExecutorCompletionService9Test", |
525 |
|
}; |
526 |
|
addNamedTestClasses(suite, java9TestClassNames); |
527 |
|
} |
1835 |
|
} catch (NoSuchElementException success) {} |
1836 |
|
assertFalse(it.hasNext()); |
1837 |
|
} |
1838 |
+ |
|
1839 |
+ |
public <T> Callable<T> callableThrowing(final Exception ex) { |
1840 |
+ |
return new Callable<T>() { public T call() throws Exception { throw ex; }}; |
1841 |
+ |
} |
1842 |
+ |
|
1843 |
+ |
public Runnable runnableThrowing(final RuntimeException ex) { |
1844 |
+ |
return new Runnable() { public void run() { throw ex; }}; |
1845 |
+ |
} |
1846 |
+ |
|
1847 |
+ |
/** A reusable thread pool to be shared by tests. */ |
1848 |
+ |
static final ExecutorService cachedThreadPool = |
1849 |
+ |
new ThreadPoolExecutor(0, Integer.MAX_VALUE, |
1850 |
+ |
1000L, MILLISECONDS, |
1851 |
+ |
new SynchronousQueue<Runnable>()); |
1852 |
+ |
|
1853 |
|
} |