public WorkUnitContext(BuildableItem item) { this.item = item; this.task = item.task; this.future = (FutureImpl)item.getFuture(); // JENKINS-51584 do not use item.getAllActions() here. this.actions = new ArrayList<Action>(item.getActions()); // +1 for the main task int workUnitSize = task.getSubTasks().size(); startLatch = new Latch(workUnitSize) { @Override protected void onCriteriaMet() { // on behalf of the member Executors, // the one that executes the main thing will send notifications // Unclear if this will work with AsynchronousExecution; it *seems* this is only called from synchronize which is only called from synchronizeStart which is only called from an executor thread. Executor e = Executor.currentExecutor(); if (e.getCurrentWorkUnit().isMainWork()) { e.getOwner().taskAccepted(e,task); } } }; endLatch = new Latch(workUnitSize); }
public WorkUnitContext(BuildableItem item) { this.item = item; this.task = item.task; this.future = (FutureImpl)item.getFuture(); this.actions = new ArrayList<Action>(item.getAllActions()); // +1 for the main task int workUnitSize = task.getSubTasks().size(); startLatch = new Latch(workUnitSize) { @Override protected void onCriteriaMet() { // on behalf of the member Executors, // the one that executes the main thing will send notifications // Unclear if this will work with AsynchronousExecution; it *seems* this is only called from synchronize which is only called from synchronizeStart which is only called from an executor thread. Executor e = Executor.currentExecutor(); if (e.getCurrentWorkUnit().isMainWork()) { e.getOwner().taskAccepted(e,task); } } }; endLatch = new Latch(workUnitSize); }
public WorkUnitContext(BuildableItem item) { this.item = item; this.task = item.task; this.future = (FutureImpl)item.getFuture(); this.actions = item.getActions(); // +1 for the main task int workUnitSize = Tasks.getSubTasksOf(task).size(); startLatch = new Latch(workUnitSize) { @Override protected void onCriteriaMet() { // on behalf of the member Executors, // the one that executes the main thing will send notifications Executor e = Executor.currentExecutor(); if (e.getCurrentWorkUnit().isMainWork()) { e.getOwner().taskAccepted(e,task); } } }; endLatch = new Latch(workUnitSize); }
public WorkUnitContext(BuildableItem item) { this.item = item; this.task = item.task; this.future = (FutureImpl)item.getFuture(); this.actions = item.getActions(); // +1 for the main task int workUnitSize = Tasks.getSubTasksOf(task).size(); startLatch = new Latch(workUnitSize) { @Override protected void onCriteriaMet() { // on behalf of the member Executors, // the one that executes the main thing will send notifications Executor e = Executor.currentExecutor(); if (e.getCurrentWorkUnit().isMainWork()) { e.getOwner().taskAccepted(e,task); } } }; endLatch = new Latch(workUnitSize); }
public WorkUnitContext(BuildableItem item) { this.item = item; this.task = item.task; this.future = (FutureImpl) item.getFuture(); this.actions = item.getActions(); // +1 for the main task int workUnitSize = Tasks.getSubTasksOf(task).size(); startLatch = new Latch(workUnitSize) { @Override protected void onCriteriaMet() { // on behalf of the member Executors, // the one that executes the main thing will send notifications Executor e = Executor.currentExecutor(); if (e.getCurrentWorkUnit().isMainWork()) { e.getOwner().taskAccepted(e, task); } } }; endLatch = new Latch(workUnitSize); }
public WorkUnitContext(BuildableItem item) { this.item = item; this.task = item.task; this.future = (FutureImpl)item.getFuture(); this.actions = item.getActions(); // +1 for the main task int workUnitSize = Tasks.getSubTasksOf(task).size(); startLatch = new Latch(workUnitSize) { @Override protected void onCriteriaMet() { // on behalf of the member Executors, // the one that executes the main thing will send notifications Executor e = Executor.currentExecutor(); if (e.getCurrentWorkUnit().isMainWork()) { e.getOwner().taskAccepted(e,task); } } }; endLatch = new Latch(workUnitSize); }