ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: [PATCH] Asynchronous execution of processes
Date Fri, 09 Nov 2001 08:28:39 GMT
On Fri, 9 Nov 2001 12:54, Jose Alberto Fernandez wrote:
> > I'm not sure whether this satisfies all use cases people have for
> > detach, leaving the currently running VM completely would probably be
> > preferred by most people.  Maybe we should use your version for all
> > the OSes we don't have an OS dependent version for?
>
> There are two issues here, first what to do with IO if not redirected; and
> second what does each OS does when the VM that spawn the process ends.
> In the case of Win2k the process will stay running if there is no IO to
> stdout/err.
>
> As someone suggested we could do something about redirecting IO to a file
> which it cannot be done today, but taha is only if the user specifies usage
> of a file.

Having no idea on the portability of such things but do most OSes have some 
form of /dev/null which we could open things to? 

If not how do most OSes handle sharing stdout/stderr. win32 and unix seem to 
handle sharing fine however java barfs at it if you share the same 
InputStream. So what we would have to do is use the FileDescriptor objects 
for stdout, stderr etc and then create separate OutputStream objects (that 
all refer to same FDs) for every different exec. Does this sound feasible?

> > The Unix case would be more or less trivial as long as detach="true"
> > implies running via a shell script.  A platform dependent solution
> > would make the use of a timeout feature impossible, but I don't think
> > a combination of detach (which is spawn and forget about it in my
> > book) and timeout is something people will need anyway.
>
> It may be quite handy for the "test server scenario of Ken" you could have
> something like:
>     <target ....>
>         <exec timeout="1h" executable="startserver" detach="true"..../>
>         <run-tests ....>
>         <exec executable="stopserver" />
>     </target>
>
> If the test get stuck, then the server will be terminated after the timeout
> which should make any further stuff to finish and fail. Granted, this does
> not cover all cases but you can see it may be useful.

having no idea on feasability of this. I would like to see four tasks. These 
would be

start (ie async exec kickstart)
stop (ask process to shutdown nicely)
join (wait till other process shutsdown)
kill (kill the process imediately)

I have suspicions that this will not be possible from pure java but I figured 
I would throw this out there to see if anyone else has any good ideas on how 
to implement this ;)

-- 
Cheers,

Pete

*------------------------------------------------------*
|  Hlade's Law: If you have a difficult task, give it  |
|     to a lazy person -- they will find an easier     |
|                    way to do it.                     |
*------------------------------------------------------*

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message