public interface WorkerExecutor
Work should be submitted with a WorkAction class representing the implementation of the unit of work
and an action to configure the parameters of the unit of work (via WorkParameters).
workerExecutor.noIsolation().submit(MyWorkActionImpl.class) { MyWorkParameters parameters ->
parameters.inputFile = project.file('foo')
parameters.outputFile = project.layout.buildDirectory.file('bar')
}
An instance of the executor can be injected into a task by annotating a public constructor or property getter method with javax.inject.Inject.
| Modifier and Type | Method | Description |
|---|---|---|
void |
await() |
Blocks until all work associated with the current build operation is complete.
|
WorkQueue |
classLoaderIsolation() |
Creates a
WorkQueue to submit work for asynchronous execution with an isolated classloader. |
WorkQueue |
classLoaderIsolation(Action<ClassLoaderWorkerSpec> action) |
Creates a
WorkQueue to submit work for asynchronous execution with an isolated classloader and the requirements specified in the supplied ClassLoaderWorkerSpec. |
WorkQueue |
noIsolation() |
Creates a
WorkQueue to submit work for asynchronous execution with no isolation. |
WorkQueue |
noIsolation(Action<WorkerSpec> action) |
Creates a
WorkQueue to submit work for asynchronous execution with no isolation and the requirements specified in the supplied WorkerSpec. |
WorkQueue |
processIsolation() |
Creates a
WorkQueue to submit work for asynchronous execution in a daemon process. |
WorkQueue |
processIsolation(Action<ProcessWorkerSpec> action) |
Creates a
WorkQueue to submit work for asynchronous execution in a daemon process. |
void |
submit(Class<? extends Runnable> actionClass,
Action<? super WorkerConfiguration> configAction) |
Deprecated.
|
@Deprecated void submit(Class<? extends Runnable> actionClass, Action<? super WorkerConfiguration> configAction)
IsolationMode.PROCESS will execute in an idle daemon that meets the requirements set
in the WorkerConfiguration. If no idle daemons are available, a new daemon will be started. Any errors
will be thrown from await() or from the surrounding task action if await() is not used.@Incubating WorkQueue noIsolation()
WorkQueue to submit work for asynchronous execution with no isolation.@Incubating WorkQueue classLoaderIsolation()
WorkQueue to submit work for asynchronous execution with an isolated classloader.@Incubating WorkQueue processIsolation()
WorkQueue to submit work for asynchronous execution in a daemon process.
Work will execute in an idle daemon, if available. If no idle daemons are available, a new daemon will be started.@Incubating WorkQueue noIsolation(Action<WorkerSpec> action)
WorkQueue to submit work for asynchronous execution with no isolation and the requirements specified in the supplied WorkerSpec.@Incubating WorkQueue classLoaderIsolation(Action<ClassLoaderWorkerSpec> action)
WorkQueue to submit work for asynchronous execution with an isolated classloader and the requirements specified in the supplied ClassLoaderWorkerSpec.@Incubating WorkQueue processIsolation(Action<ProcessWorkerSpec> action)
WorkQueue to submit work for asynchronous execution in a daemon process.
Work will execute in an idle daemon matching the requirements specified in the supplied ProcessWorkerSpec, if available. If no idle daemons are available, a new daemon will be started.void await()
throws WorkerExecutionException
WorkerExecutionException - when a failure occurs while executing the work.