Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 19475 invoked by uid 500); 20 Apr 2001 17:22:25 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 19299 invoked from network); 20 Apr 2001 17:22:17 -0000 Message-ID: <530FCFB08F31D411A47F009027D5D01F01127C76@conan.esr.hp.com> From: "Halim, Salman" To: "'ant-dev@jakarta.apache.org'" Subject: RE: exec in thread Date: Fri, 20 Apr 2001 13:25:15 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N that's what i was thinking, too; i was thinking of either tweaking the exec task to accept a "background=true" (false by default so as to not conflict with existing scripts) attribute that would prepend a "start" or the "/bin/sh" (with "&" appended), depending on the os. then, i thought, what if i use a simple launcher which calls ant with a -DcommandStart="/bin/sh -c" -DcommandEnd="&" on unix and "start" and "", respectively, on windows and just change all my commands to start with ${commandStart} as the executable and ${commandEnd} as the very last part. need to look into this, though i have a feeling the unix variant being two words will require a bit more tweaking. thoughts? -- Salman Halim Advisory Software Engineer, HP Bluestone Quidquid latine dictum sit, altum viditur. -----Original Message----- From: Jose Alberto Fernandez [mailto:j_a_fernandez@yahoo.com] Sent: Friday, April 20, 2001 12:05 PM To: ant-dev@jakarta.apache.org Subject: RE: exec in thread 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:salman@Bluestone.com] > Sent: Friday, April 20, 2001 4:21 PM > To: 'ant-dev@jakarta.apache.org' > 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: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 > > > > > > > > > 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 > > > > > > > > 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" > To: > 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. > > > > > > > > >