alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (parallel.xml)

This example Ant source code file (parallel.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

The parallel.xml source code

<?xml version="1.0"?>

<project name="parallel-test" basedir="." default="help">
  <target name="testBasic">
    <parallel>
      <sequential>
        <sleep seconds="1"/>
        <echo message="${test.delayed}"/>
      </sequential>
      <echo message="${test.direct}"/>
    </parallel>
  </target>

  <target name="testFail">
    <parallel>
      <sequential>
        <sleep seconds="1"/>
        <echo message="${test.delayed}"/>
      </sequential>
      <fail message="${test.failure}"/>
    </parallel>
  </target>

  <target name="testThreadCount">
    <echo>|1/
    <parallel threadCount='1' pollInterval="60">
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="30"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="60"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="90"/>
        <echo message="-"/>
      </sequential>
    </parallel>
    <echo>|2/
    <parallel threadCount='2' pollInterval="30">
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="30"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="60"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="90"/>
        <echo message="-"/>
      </sequential>
    </parallel>
    <echo>|3/
    <parallel threadCount='3' pollInterval="30">
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="30"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="60"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="90"/>
        <echo message="-"/>
      </sequential>
    </parallel>
    <echo>|4/
    <parallel threadCount='4' pollInterval="30">
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="30"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="60"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="90"/>
        <echo message="-"/>
      </sequential>
    </parallel>
    <echo>|4/
    <parallel threadsPerProcessor='1' threadcount='4' pollInterval="30">
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="30"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="60"/>
        <echo message="-"/>
      </sequential>
      <sequential>
        <echo message="+"/>
        <sleep milliseconds="90"/>
        <echo message="-"/>
      </sequential>
    </parallel>
    <echo>|
    
  </target>

  <target name="testDemux">
    <parallel>
      <demuxtest/>
      <demuxtest/>
      <demuxtest/>
      <demuxtest/>
      <demuxtest/>
    </parallel>
  </target>
  
  <target name="help">
    <echo>Test build file for the <parallel> task. 
    <echo>Use the various targets to run the tests.
  </target>
</project>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant parallel.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.