Skip to content

Commit

Permalink
Fix for MID-1921.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jul 16, 2014
1 parent 3f56244 commit 8e7aa64
Showing 1 changed file with 12 additions and 3 deletions.
Expand Up @@ -390,13 +390,13 @@ public boolean suspendTasksResolved(Collection<Task> tasks, long waitForStop, Op

private String waitingInfo(long waitForStop) {
if (waitForStop == WAIT_INDEFINITELY) {
return "wait indefinitely";
return "stop tasks, and wait for their completion (if necessary)";
} else if (waitForStop == DO_NOT_WAIT) {
return "stop tasks, but do not wait";
} else if (waitForStop == DO_NOT_STOP) {
return "do not stop tasks";
} else {
return "stop tasks and wait " + waitForStop + " ms for their completion";
return "stop tasks and wait " + waitForStop + " ms for their completion (if necessary)";
}
}

Expand Down Expand Up @@ -725,8 +725,17 @@ public void suspendAndDeleteTasks(Collection<String> taskOids, long suspendTimeo
}
}

List<Task> tasksToBeSuspended = new ArrayList<>();
for (Task task : tasksToBeDeleted) {
if (task.getExecutionStatus() == TaskExecutionStatus.RUNNABLE) {
tasksToBeSuspended.add(task);
}
}

// now suspend the tasks before deletion
suspendTasksResolved(tasksToBeDeleted, suspendTimeout, result);
if (!tasksToBeSuspended.isEmpty()) {
suspendTasksResolved(tasksToBeSuspended, suspendTimeout, result);
}

// delete them
for (Task task : tasksToBeDeleted) {
Expand Down

0 comments on commit 8e7aa64

Please sign in to comment.