ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Christen" <...@active.ch>
Subject AW: [PROPOSAL] Add "parallel" capability to Java task.
Date Wed, 21 Feb 2001 19:21:18 GMT
And what about the output and logging ? Did you try to use the XmlLogger
when you use this. My experiance was that it would need more than only start
a new thread. Actualy I did all the changes - but wait until 1.3 is ready.

Thomas
> -----Urspr√ľngliche Nachricht-----
> Von: Twiggs, Glenn [mailto:Glenn_Twiggs@bmc.com]
> Gesendet am: Donnerstag, 15. Februar 2001 21:02
> An: 'Ant-Dev'
> Betreff: [PROPOSAL] Add "parallel" capability to Java task.
>
> I have the following problem:
>
> I want to run a Java class from within Ant, but I don't want to wait for
> execution of the class to complete.
>
> Example:
>
> I have written a servlet-based application. After the compile
> portion of my
> build completes, I want to start Tomcat and then execute my JUnit tasks.
>
> Proposed Solution:
>
> Add functionality to the Java task which allows the class to run in a
> separate thread.
>
> To access this functionality, an attribute (which I have been referring to
> as "parallel") is set to true. The default value for this attribute is
> false, so existing build xml will not need to be updated.
>
>
> Here is a diff of my proposed changes. I wanted to get a feel for interest
> in this change before completing the work. Please let me know
> what you think
> (as if you wouldn't!).
>
> Index: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs
> /Java.java
> ,v
> retrieving revision 1.24
> diff -r1.24 Java.java
> 95a96,116
> >     class ParallelThread extends Thread {
> >         Java java;
> >
> >         ParallelThread(Java java) {
> >             this.java = java;
> >         }
> >
> >         public void run() {
> >             java.run(java.cmdl.getCommandline());
> >         }
> >     }
> >
> >     boolean parallel = false;
> >
> >     /**
> >      * Set the parallel flag.
> >      */
> >     public void setParallel(boolean s) {
> >         this.parallel = s;
> >     }
> >
> 110,112c131,142
> <             log("Forking " + cmdl.toString(), Project.MSG_VERBOSE);
> <
> <             return run(cmdl.getCommandline());
> ---
> >             if (parallel) {
> >                 log("Forking in parallel " + cmdl.toString(),
> Project.MSG_VERBOSE);
> >
> >                 ParallelThread thread = new ParallelThread(this);
> >                 thread.start();
> >
> >                 return 0;
> >             } else {
> >                 log("Forking " + cmdl.toString(), Project.MSG_VERBOSE);
> >
> >                 return run(cmdl.getCommandline());
> >             }
>
>
> Glenn.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-dev-help@jakarta.apache.org
>


Mime
View raw message