Package io.servicetalk.concurrent.api
Class ExecutorRule<E extends Executor>
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- io.servicetalk.concurrent.api.ExecutorRule<E>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafter()protected voidbefore()Eexecutor()static ExecutorRule<Executor>newRule()Create anExecutorRulewith a default executor.static ExecutorRule<Executor>withExecutor(java.util.function.Supplier<Executor> executorSupplier)Create anExecutorRulewith the specifiedexecutor.static ExecutorRule<Executor>withNamePrefix(java.lang.String namePrefix)Create anExecutorRulewith a default executor, configured to prefix thread names withnamePrefix.static ExecutorRule<TestExecutor>withTestExecutor()Create anExecutorRulewith aTestExecutor.
-
-
-
Method Detail
-
newRule
public static ExecutorRule<Executor> newRule()
Create anExecutorRulewith a default executor.- Returns:
- a new
ExecutorRule.
-
withTestExecutor
public static ExecutorRule<TestExecutor> withTestExecutor()
Create anExecutorRulewith aTestExecutor.executor()will return theTestExecutorto allow controlling the executor in tests.- Returns:
- a new
ExecutorRule.
-
withExecutor
public static ExecutorRule<Executor> withExecutor(java.util.function.Supplier<Executor> executorSupplier)
Create anExecutorRulewith the specifiedexecutor.- Parameters:
executorSupplier- TheExecutorSupplierto use.- Returns:
- a new
ExecutorRule.
-
withNamePrefix
public static ExecutorRule<Executor> withNamePrefix(java.lang.String namePrefix)
Create anExecutorRulewith a default executor, configured to prefix thread names withnamePrefix.- Parameters:
namePrefix- the name to prefix thread names with.- Returns:
- a new
ExecutorRule.
-
executor
public E executor()
-
before
protected void before()
- Overrides:
beforein classorg.junit.rules.ExternalResource
-
after
protected void after()
- Overrides:
afterin classorg.junit.rules.ExternalResource
-
-