ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Halim, Salman" <sal...@Bluestone.com>
Subject RE: exec in thread
Date Fri, 20 Apr 2001 15:20:35 GMT
i appreciate your response.  thank you.

i understand what you're saying about possible synchronization or deadlock
issues with a parallel execution.  my intention is to start a process that
will keep running long after the ant build is done.  basically, i'm not
using ant to install anything, per se.  i'm using ant's platform independent
way of specifying environment variables to basically act as a launcher that
will allow me to launch a process on both windows and unix using just this
one configuration file.  (rather than having a windows batch file AND a
separate unix shell script:  two things to maintain.  this is what we have
right now.)

i had initially toyed with the idea of writing a (much simpler) application
from scratch that would basically accept an xml file describing environment
variable settings, things to launch, whether to do it in the background etc.
and would then generate both windows batch files as well as unix shell
scripts from that.  however, i figured using ant would allow me to NOT have
to do all that coding by hand :) even though ant wasn't necessarily designed
for the task.

what i need to be able to do is start more than one process, each running in
parallel (otherwise, i have nothing against letting the ant "build" keep
running).

any thoughts on this approach would be appreciated.

thanks again!

-- 
Salman Halim
Advisory Software Engineer, HP Bluestone
Quidquid latine dictum sit, altum viditur.


-----Original Message-----
From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
Sent: Friday, April 20, 2001 10:52 AM
To: ant-dev@jakarta.apache.org
Subject: Re: exec in thread


Salman,

A couple of issues. I understand this is incomplete and there are therefore
some issues you have yet to encounter.

Firstly, we have been discussing supporting parallel execution of tasks
within a target. This will satisfy a number of needs to either run test
harnesses against servers or to better utilise powerful hardware during a
build. A possible expression might be

<target>
   <parallel>
       <javac>
       <javac>
   </parallel>
</target>

Now, that is not quite what you are proposing - you are basically just
running the thread and forgetting about it - you don't join to that thread
again. Rather than tackle this for the particular task (exec), this could
be approached as

<target>
    <daemon>
        <exec>
    </daemon>
</target>

Thus any task could be run in the background and not just exec. I think,
however, we need to think carefully about the implications of threads
running while ant continues to run. If the thread continues to interact
with Ant there may be synchronization or deadlock issues. Also the thread
may keep the Ant VM alive when Ant itself has finished.

Anyway, if you continue to go with your task, I think one issue you will
encounter is the management of the output of the exec task and connecting
that into Ant's event mechanism.

Conor




----- Original Message -----
From: "Halim, Salman" <salman@Bluestone.com>
To: <ant-dev@jakarta.apache.org>
Sent: Saturday, April 21, 2001 12:05 AM
Subject: FW: exec in thread


> hi,
>
> i didn't recieve a response last time so i'm trying again. . .  any
advice
> is appreciated.  thank you!
>
> --
> Salman Halim
> Advisory Software Engineer, HP Bluestone
> Quidquid latine dictum sit, altum viditur.
>
>
> -----Original Message-----
> From: Halim, Salman [mailto:salman@Bluestone.com]
> Sent: Tuesday, April 17, 2001 3:56 PM
> To: 'ant-user@jakarta.apache.org'; 'ant-dev@jakarta.apache.org'
> Subject: exec in thread
>
>
> hi,
>
> i have the attached MyExec class; this is supposed to be a primitive
> replacement for the exec task that will run its target in the background
(by
> spawning a thread and running in there).  it isn't complete yet, but i
> wanted to do some testing before going any further:
>
> in short, the thread doesn't continue to run once the main class is done.
> if i uncomment the delay loop in there, then it runs (because the main
> MyExec is still running).
>
> can anybody see if i'm doing something anti-ant in there, please?  this
> class is not very complicated, i promise!
>
> thank you in advance,
>
> --
> Salman Halim
> Advisory Software Engineer, HP Bluestone
> Quidquid latine dictum sit, altum viditur.
>
>
>
>

Mime
View raw message