From 12fb88e093ad0ed800446fe1318945b6057345bb Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Thu, 9 Aug 2001 10:48:12 +0000 Subject: [PATCH] Description of parallel task git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269529 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/CoreTasks/parallel.html | 79 +++++++++++++++++++++++++++++ docs/manual/coretasklist.html | 1 + 2 files changed, 80 insertions(+) create mode 100644 docs/manual/CoreTasks/parallel.html diff --git a/docs/manual/CoreTasks/parallel.html b/docs/manual/CoreTasks/parallel.html new file mode 100644 index 000000000..d6d12833b --- /dev/null +++ b/docs/manual/CoreTasks/parallel.html @@ -0,0 +1,79 @@ + + + + +Ant User Manual + + + + +

Parallel

+

Description

+

Parallel is a container task - it can contain other Ant tasks. Each nested +task within the parallel task will be executed in its own thread.

+ +

Parallel tasks have a number of uses in an Ant build file including: +

+ +

Care must be taken when using multithreading to ensure the tasks within the +threads do not interact. For example, two javac compile tasks which write +classes into the same destination directory may interact where one tries to +read a class for depenency information while the other task is writing the +class file. Be sure to avoid these types of interactions within a +<parallel> task

+ +

The parallel task has no attributes and does not support any nested +elements apart from Ant tasks. Any valid Ant task may be embedded within a +parallel task, including other parallel tasks.

+ +

Note that while the tasks within the parallel task are being run, the main +thread will be blocked waiting for all the child threads to complete.

+ +

If any of the tasks within the <parallel> task fails, the remaining +tasks in other threads will continue to run until all threads have completed. +In this sitiuation, the parallel task will also fail.

+ +

Examples

+
+<parallel>
+  <wlrun ...>
+  <sequential>
+    <sleep seconds="30"/>
+    <junit ...>
+    <wlstop/>
+  </sequential>
+</parallel>
+
+

This example represents a typical pattern for testing a server application. +In one thread the server is started (the wlrun task). The other thread consists +of a three tasks which are performed in sequence. The sleep task is used to +give the server time to come up. Another task which is capabale of validating +that the server is available could be used in place of the sleep task. The +test harness is then run. Once the tests are complete, the server is stopped +(using wlstop in this example), allowing both threads to complete. The +parallel task will also complete at this time and the build will then +continue.

+ +
+<parallel>
+  <javac ...> <!-- compiler servlet code -->
+  <wljspc ...> <!-- precompile JSPs -->
+</parallel>
+
+ +

This example shows two independent tasks being run to achieve better +resource utilization during the build. In this instance, some servlets are being +compiled in one thead and a set of JSPs is being precompiled in another. As +noted above, you need to be careful that the two tasks are independent, both in +terms of their dependencies and in terms of their potential interactions in +Ant's external environment.

+
+

Copyright © 2000,2001 Apache Software Foundation. All rights +Reserved.

+ + + diff --git a/docs/manual/coretasklist.html b/docs/manual/coretasklist.html index 674b63fe4..cab1b77a2 100644 --- a/docs/manual/coretasklist.html +++ b/docs/manual/coretasklist.html @@ -52,6 +52,7 @@ Mail
Mkdir
Move
+Parallel
Patch
PathConvert
Property