use of org.gradle.workers.WorkerConfiguration in project gradle by gradle.
the class DefaultWorkerExecutor method submit.
@Override
public void submit(Class<? extends Runnable> actionClass, Action<WorkerConfiguration> configAction) {
WorkerConfiguration configuration = new DefaultWorkerConfiguration(fileResolver);
configAction.execute(configuration);
String description = configuration.getDisplayName() != null ? configuration.getDisplayName() : actionClass.getName();
WorkerAction action = new WorkerRunnableAction(description, actionClass);
submit(action, configuration.getParams(), configuration.getForkOptions().getWorkingDir(), configuration.getForkMode(), getDaemonForkOptions(actionClass, configuration));
}
use of org.gradle.workers.WorkerConfiguration in project gradle by gradle.
the class DefaultWorkerExecutor method submit.
@Override
public void submit(Class<? extends Runnable> actionClass, Action<? super WorkerConfiguration> configAction) {
WorkerConfiguration configuration = new DefaultWorkerConfiguration(fileResolver);
configAction.execute(configuration);
String description = configuration.getDisplayName() != null ? configuration.getDisplayName() : actionClass.getName();
// Serialize parameters in this thread prior to starting work in a separate thread
ActionExecutionSpec spec;
try {
spec = new SerializingActionExecutionSpec(actionClass, description, configuration.getForkOptions().getWorkingDir(), configuration.getParams());
} catch (Throwable t) {
throw new WorkExecutionException(description, t);
}
submit(spec, configuration.getIsolationMode(), getDaemonForkOptions(actionClass, configuration));
}
use of org.gradle.workers.WorkerConfiguration in project gradle by gradle.
the class WorkerTask method executeTask.
@TaskAction
public void executeTask() {
for (int i = 0; i < outputSize; i++) {
final int index = i;
getWorkerExecutor().submit(UnitOfWork.class, new Action<WorkerConfiguration>() {
@Override
public void execute(WorkerConfiguration workerConfiguration) {
workerConfiguration.setDisplayName(getName() + " work for " + index);
workerConfiguration.setIsolationMode(isolationMode);
File outputFile = new File(outputDir, "out-" + index + ".txt");
workerConfiguration.setParams(index, outputFile);
}
});
}
}
Aggregations