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
InterruptedExceptionpublic Duration shutdownAndWait(ExecutorService executorService) throws InterruptedException
InterruptedExceptionpublic Duration shutdownAndWait(ExecutorService executorService, Duration shutdownTimeout) throws InterruptedException
InterruptedExceptionpublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic int getExecutorServiceCount()
public <T> List<T> runConcurrently(int threadCount, Callable<T> task) throws ExecutionException, InterruptedException
Copyright © 2023 Atlassian. All rights reserved.