public DefaultTaskGraphExecuter(ListenerManager listenerManager, TaskPlanExecutor taskPlanExecutor, Factory<? extends TaskExecuter> taskExecuter, BuildCancellationToken cancellationToken, BuildOperationExecutor buildOperationExecutor) { this.taskPlanExecutor = taskPlanExecutor; this.taskExecuter = taskExecuter; this.buildOperationExecutor = buildOperationExecutor; graphListeners = listenerManager.createAnonymousBroadcaster(TaskExecutionGraphListener.class); taskListeners = listenerManager.createAnonymousBroadcaster(TaskExecutionListener.class); internalTaskListener = listenerManager.getBroadcaster(InternalTaskExecutionListener.class); taskExecutionPlan = new DefaultTaskExecutionPlan(cancellationToken); }
public void process(final TaskExecutionPlan taskExecutionPlan, final TaskExecutionListener taskListener) { StoppableExecutor executor = executorFactory.create("Task worker"); try { startAdditionalWorkers(taskExecutionPlan, taskListener, executor); taskWorker(taskExecutionPlan, taskListener).run(); taskExecutionPlan.awaitCompletion(); } finally { executor.stop(); } }
private void startAdditionalWorkers(TaskExecutionPlan taskExecutionPlan, TaskExecutionListener taskListener, Executor executor) { List<Project> projects = getAllProjects(taskExecutionPlan); int numExecutors = Math.min(executorCount, projects.size()); LOGGER.info("Using {} parallel executor threads", numExecutors); for (int i = 1; i < numExecutors; i++) { Runnable worker = taskWorker(taskExecutionPlan, taskListener); executor.execute(worker); } }
public void addTaskExecutionListener(TaskExecutionListener listener) { taskListeners.add(listener); }
public void removeTaskExecutionListener(TaskExecutionListener listener) { taskListeners.remove(listener); }
public void process(final TaskExecutionPlan taskExecutionPlan, final TaskExecutionListener taskListener) { taskWorker(taskExecutionPlan, taskListener).run(); taskExecutionPlan.awaitCompletion(); }
protected Runnable taskWorker(TaskExecutionPlan taskExecutionPlan, TaskExecutionListener taskListener) { return new TaskExecutorWorker(taskExecutionPlan, taskListener); }
private TaskExecutorWorker(TaskExecutionPlan taskExecutionPlan, TaskExecutionListener taskListener) { this.taskExecutionPlan = taskExecutionPlan; this.taskListener = taskListener; }
public DefaultTaskGraphExecuter(ListenerManager listenerManager, TaskPlanExecutor taskPlanExecutor, BuildCancellationToken cancellationToken) { this.taskPlanExecutor = taskPlanExecutor; graphListeners = listenerManager.createAnonymousBroadcaster(TaskExecutionGraphListener.class); taskListeners = listenerManager.createAnonymousBroadcaster(TaskExecutionListener.class); taskExecutionPlan = new DefaultTaskExecutionPlan(cancellationToken); }
public DefaultTaskGraphExecuter(ListenerManager listenerManager, TaskPlanExecutor taskPlanExecutor) { this.taskPlanExecutor = taskPlanExecutor; graphListeners = listenerManager.createAnonymousBroadcaster(TaskExecutionGraphListener.class); taskListeners = listenerManager.createAnonymousBroadcaster(TaskExecutionListener.class); }
void process(TaskExecutionPlan taskExecutionPlan, TaskExecutionListener taskListener);