use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinPoolTest method testInvokeAny1.
/**
* invokeAny(null) throws NullPointerException
*/
public void testInvokeAny1() throws Throwable {
ExecutorService e = new ForkJoinPool(1);
PoolCleaner cleaner = null;
try {
cleaner = cleaner(e);
try {
e.invokeAny(null);
shouldThrow();
} catch (NullPointerException success) {
}
} finally {
if (cleaner != null) {
cleaner.close();
}
}
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinPoolTest method testTimedInvokeAll3.
/**
* timed invokeAll(c) throws NullPointerException if c has null elements
*/
public void testTimedInvokeAll3() throws InterruptedException {
ExecutorService e = new ForkJoinPool(1);
PoolCleaner cleaner = null;
try {
cleaner = cleaner(e);
List<Callable<String>> l = new ArrayList<>();
l.add(new StringTask());
l.add(null);
try {
e.invokeAll(l, randomTimeout(), randomTimeUnit());
shouldThrow();
} catch (NullPointerException success) {
}
} finally {
if (cleaner != null) {
cleaner.close();
}
}
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinPoolTest method testInvokeAll1.
/**
* invokeAll(null) throws NullPointerException
*/
public void testInvokeAll1() throws Throwable {
ExecutorService e = new ForkJoinPool(1);
PoolCleaner cleaner = null;
try {
cleaner = cleaner(e);
try {
e.invokeAll(null);
shouldThrow();
} catch (NullPointerException success) {
}
} finally {
if (cleaner != null) {
cleaner.close();
}
}
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinPoolTest method testDefaultInitialState.
/**
* Successfully constructed pool reports default factory,
* parallelism and async mode policies, no active threads or
* tasks, and quiescent running state.
*/
public void testDefaultInitialState() {
ForkJoinPool p = new ForkJoinPool(1);
PoolCleaner cleaner = null;
try {
cleaner = cleaner(p);
assertSame(ForkJoinPool.defaultForkJoinWorkerThreadFactory, p.getFactory());
assertFalse(p.getAsyncMode());
assertEquals(0, p.getActiveThreadCount());
assertEquals(0, p.getStealCount());
assertEquals(0, p.getQueuedTaskCount());
assertEquals(0, p.getQueuedSubmissionCount());
assertFalse(p.hasQueuedSubmissions());
assertFalse(p.isShutdown());
assertFalse(p.isTerminating());
assertFalse(p.isTerminated());
} finally {
if (cleaner != null) {
cleaner.close();
}
}
}
use of java8.util.concurrent.ForkJoinPool in project streamsupport by stefan-zobel.
the class ForkJoinPoolTest method testTimedInvokeAny3.
/**
* timed invokeAny(c) throws NullPointerException if c has null elements
*/
public void testTimedInvokeAny3() throws Throwable {
CountDownLatch latch = new CountDownLatch(1);
ExecutorService e = new ForkJoinPool(1);
PoolCleaner cleaner = null;
try {
cleaner = cleaner(e);
List<Callable<String>> l = new ArrayList<>();
l.add(latchAwaitingStringTask(latch));
l.add(null);
try {
e.invokeAny(l, randomTimeout(), randomTimeUnit());
shouldThrow();
} catch (NullPointerException success) {
}
latch.countDown();
} finally {
if (cleaner != null) {
cleaner.close();
}
}
}
Aggregations