public class ExecutorServiceFactoryRule extends Object implements org.junit.rules.TestRule
ExecutorService
.Constructor and Description |
---|
ExecutorServiceFactoryRule(Duration shutdownTimeout,
boolean shutdownAllInterruptRunningTasks) |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
ExecutorService |
createExecutorService(int threads) |
int |
getExecutorServiceCount() |
<T> List<T> |
runConcurrently(int threadCount,
Callable<T> task) |
void |
shutdownAll() |
Duration |
shutdownAndWait(ExecutorService executorService) |
Duration |
shutdownAndWait(ExecutorService executorService,
Duration shutdownTimeout) |
public ExecutorServiceFactoryRule(Duration shutdownTimeout, boolean shutdownAllInterruptRunningTasks)
public ExecutorService createExecutorService(int threads)
public void shutdownAll() throws InterruptedException
InterruptedException
public Duration shutdownAndWait(ExecutorService executorService) throws InterruptedException
InterruptedException
public Duration shutdownAndWait(ExecutorService executorService, Duration shutdownTimeout) throws InterruptedException
InterruptedException
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
public int getExecutorServiceCount()
public <T> List<T> runConcurrently(int threadCount, Callable<T> task) throws ExecutionException, InterruptedException
Copyright © 2021 Atlassian. All rights reserved.