Browse Source

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
master
Jacobus Martinus Kruithof 20 years ago
parent
commit
0833007731
1 changed files with 18 additions and 8 deletions
  1. +18
    -8
      src/main/org/apache/tools/ant/taskdefs/Parallel.java

+ 18
- 8
src/main/org/apache/tools/ant/taskdefs/Parallel.java View File

@@ -56,9 +56,10 @@ public class Parallel extends Task
/** /**
* Add a nested task to execute parallel (asynchron). * Add a nested task to execute parallel (asynchron).
* <p> * <p>
* @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); tasks.add(nestedTask);
} }
} }
@@ -107,6 +108,7 @@ public class Parallel extends Task


/** /**
* Add a group of daemon threads * Add a group of daemon threads
* @param daemonTasks The tasks to be executed as daemon.
*/ */
public void addDaemons(TaskList daemonTasks) { public void addDaemons(TaskList daemonTasks) {
if (this.daemonTasks != null) { if (this.daemonTasks != null) {
@@ -266,13 +268,13 @@ public class Parallel extends Task
} }


synchronized (semaphore) { 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. // threads will for sure load the data from main memory.
// //
// This probably is slightly paranoid. // This probably is slightly paranoid.
} }
synchronized (semaphore) { synchronized (semaphore) {
// start any daemon threads // start any daemon threads
if (daemons != null) { if (daemons != null) {
@@ -315,7 +317,7 @@ public class Parallel extends Task
outer: outer:
while (threadNumber < numTasks && stillRunning) { while (threadNumber < numTasks && stillRunning) {
for (int i = 0; i < maxRunning; i++) { 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++]; running[i] = runnables[threadNumber++];
Thread thread = new Thread(group, running[i]); Thread thread = new Thread(group, running[i]);
thread.start(); thread.start();
@@ -340,7 +342,7 @@ public class Parallel extends Task
outer2: outer2:
while (stillRunning) { while (stillRunning) {
for (int i = 0; i < maxRunning; ++i) { 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 "); //System.out.println("Thread " + i + " is still alive ");
// still running - wait for it // still running - wait for it
try { try {
@@ -405,7 +407,7 @@ public class Parallel extends Task
private class TaskRunnable implements Runnable { private class TaskRunnable implements Runnable {
private Throwable exception; private Throwable exception;
private Task task; private Task task;
boolean finished;
private boolean finished;


/** /**
* Construct a new TaskRunnable.<p> * Construct a new TaskRunnable.<p>
@@ -443,6 +445,14 @@ public class Parallel extends Task
public Throwable getException() { public Throwable getException() {
return exception; return exception;
} }

/**
* Provides the indicator that the task has been finished.
* @return Returns true when the task is finished.
*/
boolean isFinished() {
return finished;
}
} }


} }

Loading…
Cancel
Save