I have had simillar kinds of needs and would also like some way to achieve it. In my case I wanted to use it for starting server processes, e.g., tomcat servers that must stay running in the background.
For example to run tests, I need to have the servers running first and only then can I dispatch things to it. I do not want the servers to go up and down all the time. We could do such things using the "start" command on NT and "/bin/sh -c ... &" on UNIX, do not know about other systems. Any ideas? Jose Alberto > -----Original Message----- > From: Halim, Salman [mailto:[EMAIL PROTECTED] > Sent: Friday, April 20, 2001 4:21 PM > To: '[EMAIL PROTECTED]' > Subject: RE: exec in thread > > > 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:[EMAIL PROTECTED] > Sent: Friday, April 20, 2001 10:52 AM > To: [EMAIL PROTECTED] > 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" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > 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:[EMAIL PROTECTED] > > Sent: Tuesday, April 17, 2001 3:56 PM > > To: '[email protected]'; '[EMAIL PROTECTED]' > > 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. > > > > > > > > >
