From 0833007731e08c468319eebcda0ef776a7fefdc1 Mon Sep 17 00:00:00 2001 From: Jacobus Martinus Kruithof Date: Thu, 9 Dec 2004 23:06:47 +0000 Subject: [PATCH] Checkstyle updates. (removed trailing spaces just added, updated javadoc, removed an undocumented BuildException which was neither thrown according to interface nor according to methods implementation.) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277155 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/taskdefs/Parallel.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/src/main/org/apache/tools/ant/taskdefs/Parallel.java index 7d8b310a3..f6ba851be 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Parallel.java +++ b/src/main/org/apache/tools/ant/taskdefs/Parallel.java @@ -56,9 +56,10 @@ public class Parallel extends Task /** * Add a nested task to execute parallel (asynchron). *

- * @param nestedTask Nested task to be executed in parallel + * @param nestedTask Nested task to be executed in parallel. + * must not be null. */ - public void addTask(Task nestedTask) throws BuildException { + public void addTask(Task nestedTask) { tasks.add(nestedTask); } } @@ -107,6 +108,7 @@ public class Parallel extends Task /** * Add a group of daemon threads + * @param daemonTasks The tasks to be executed as daemon. */ public void addDaemons(TaskList daemonTasks) { if (this.daemonTasks != null) { @@ -266,13 +268,13 @@ public class Parallel extends Task } synchronized (semaphore) { - // When we leave this block we can be sure all data is really - // stored in main memory before the new threads start, the new + // When we leave this block we can be sure all data is really + // stored in main memory before the new threads start, the new // threads will for sure load the data from main memory. // // This probably is slightly paranoid. } - + synchronized (semaphore) { // start any daemon threads if (daemons != null) { @@ -315,7 +317,7 @@ public class Parallel extends Task outer: while (threadNumber < numTasks && stillRunning) { for (int i = 0; i < maxRunning; i++) { - if (running[i] == null || running[i].finished) { + if (running[i] == null || running[i].isFinished()) { running[i] = runnables[threadNumber++]; Thread thread = new Thread(group, running[i]); thread.start(); @@ -340,7 +342,7 @@ public class Parallel extends Task outer2: while (stillRunning) { for (int i = 0; i < maxRunning; ++i) { - if (running[i] != null && !running[i].finished) { + if (running[i] != null && !running[i].isFinished()) { //System.out.println("Thread " + i + " is still alive "); // still running - wait for it try { @@ -405,7 +407,7 @@ public class Parallel extends Task private class TaskRunnable implements Runnable { private Throwable exception; private Task task; - boolean finished; + private boolean finished; /** * Construct a new TaskRunnable.

@@ -443,6 +445,14 @@ public class Parallel extends Task public Throwable getException() { return exception; } + + /** + * Provides the indicator that the task has been finished. + * @return Returns true when the task is finished. + */ + boolean isFinished() { + return finished; + } } }