Package ratpack.exec
Interface ExecControllerBuilder
-
- All Superinterfaces:
ExecControllerSpec
public interface ExecControllerBuilder extends ExecControllerSpec
A builder of an exec controller.- Since:
- 1.10
- See Also:
ExecControllerBuilder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ExecControllerBuilderblockingExecutor(java.util.function.Function<? super java.util.concurrent.ThreadFactory,? extends java.util.concurrent.ExecutorService> factory)A factory for creating the executor to use for blocking tasks.ExecControllerbuild()Creates a controller from the current state.ExecControllerBuildercontextClassLoader(java.lang.ClassLoader classLoader)The context classloader to initialize threads with.ExecControllerBuilderexecInitializers(java.lang.Iterable<? extends ExecInitializer> initializers)The exec initializers to use for initializing executions.ExecControllerBuilderexecInterceptors(java.lang.Iterable<? extends ExecInterceptor> interceptors)The exec interceptors to use for intercepting executions.ExecControllerBuildernumThreads(int n)Sets the number of compute threads to use.
-
-
-
Method Detail
-
numThreads
ExecControllerBuilder numThreads(int n)
Sets the number of compute threads to use.Defaults to
Runtime.getRuntime().availableProcessors() * 2.- Specified by:
numThreadsin interfaceExecControllerSpec- Parameters:
n- the number of compute threads to use- Returns:
this
-
contextClassLoader
ExecControllerBuilder contextClassLoader(java.lang.ClassLoader classLoader)
The context classloader to initialize threads with.Defaults to the current context classloader of the thread that created
this.- Specified by:
contextClassLoaderin interfaceExecControllerSpec- Parameters:
classLoader- the context classloader to initialize threads with- Returns:
this
-
blockingExecutor
ExecControllerBuilder blockingExecutor(java.util.function.Function<? super java.util.concurrent.ThreadFactory,? extends java.util.concurrent.ExecutorService> factory)
A factory for creating the executor to use for blocking tasks.It is essential that the executor uses the provided thread factory.
By default,
Executors.newCachedThreadPool()is used.- Specified by:
blockingExecutorin interfaceExecControllerSpec- Parameters:
factory- the creator of the thread factory- Returns:
this
-
execInitializers
ExecControllerBuilder execInitializers(java.lang.Iterable<? extends ExecInitializer> initializers)
The exec initializers to use for initializing executions.- Specified by:
execInitializersin interfaceExecControllerSpec- Parameters:
initializers- the exec initializers to use for initializing executions- Returns:
this
-
execInterceptors
ExecControllerBuilder execInterceptors(java.lang.Iterable<? extends ExecInterceptor> interceptors)
The exec interceptors to use for intercepting executions.- Specified by:
execInterceptorsin interfaceExecControllerSpec- Parameters:
interceptors- exec interceptors to use for intercepting executions- Returns:
this
-
build
ExecController build()
Creates a controller from the current state.- Returns:
- a controller from the current state
-
-