use of com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering in project randomizedtesting by randomizedtesting.
the class Test011RunawayThreads method ExecutorServiceContextPropagation.
@ThreadLeakLingering(linger = 2000)
@Test
public void ExecutorServiceContextPropagation() throws Throwable {
final long seed = Utils.getRunnerSeed();
final ExecutorService executor = Executors.newCachedThreadPool();
try {
executor.submit(new Runnable() {
public void run() {
RandomizedContext ctx = RandomizedContext.current();
Assert.assertEquals(seed, Utils.getSeed(ctx.getRandomness()));
}
}).get();
} catch (ExecutionException e) {
throw e.getCause();
} finally {
executor.shutdown();
executor.awaitTermination(1, TimeUnit.SECONDS);
}
}
Aggregations