commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Gustavsson <nik...@protocol7.com>
Subject [exec] Design of commons-exec
Date Mon, 01 Aug 2005 11:15:04 GMT
Hi

Lets start the discussions on the design of commons-exec. I'll start by 
describing the Ant implementation that I think is the most mature out 
there. I also think it contains the bits that would be approriate for 
this package.

This is a very short description of the cleaned up Ant exec task design:

* Exec: the former Ant task class used to create and configure Execute 
instances. Now mainly a convience class for starting new Execute instances.
* Execute: the main class for running one process. Handles creation and 
configuration of the necessary objects (stream pump, watchdog, process 
destroyer). Can wait for the full execution time to enable synchronous 
return of the process return code or spawn a process to run async.
* Process destroyer: adds itself as a shutdown hook, Execute adds and 
removes created processes to ensure that they are correctly destroyed 
when the JVM stops.
* WatchDog: used to time out a running process. After a given time has 
passed, the process is checked if it's still running and there after 
destroyed.
* CommandLauncher: a family of classes for actually starting the 
processes. Implementations exist for e.g. Java 1.1, Java 1.3, WinNT, 
Mac, VMS and so on. These classes handles the platform specifics.
* Environment: used to retrive the current environment as well as 
setting new environment variables. Reading the current environment is 
done using platform specific commands (e.g. "cmd /c set", "env", 
"/bin/env") and parsing the result. This could of course be improved on 
J2SE 5.0 to use System.getenv() instead.
* StreamPumper: used to read/write the three stream (in, out, error) 
simultaniously.
* CommandLine: class for handling (e.g. parsing, quoting) command lines.

There are additional classes but the list above are those of main interest.

* Do you think this fits with what you would find appropriate and useful 
for commons-exec?
* Would it be a good starting point (if so I'll create a patch for the 
code I've cleaned up and removed the Ant specifics from)?
* Should I put this on the wiki for further discussions?

/niklas

------------------
Niklas Gustavsson
niklas@protocol7.com
http://www.protocol7.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message