ariba.util.io
Class ARProcess
java.lang.Object
ariba.util.io.ARProcess
- Direct Known Subclasses:
- FileSortProcess
Deprecated. Use ariba.util.io.Exec
public class ARProcess
- extends java.lang.Object
Class ARProcess encapsulates the mess Java created with process
management. There may be more succinct implementations possible but
this is truly what was necessary to implement an interface to
allow one to start, monitor and stop a process.
ARProcess allows you to specify the command line via the
constructor or setArguments.
You can then launch the process (i.e. launch())
After launch you can call isAlive(), getOutputString(),
join() and kill(). Calling launch again, will discard the results
in the "outputstring" as expected.
When isAlive() returns true exitCode() returns the process return code.
Why the Java process interface sucks:
1) There isn't a non-blocking check for "aliveness".
2) Unless you flush the outgoing streams (from the process) the
process will not terminate.
3) The standard output from .bat files are not properly captured by
the return streams.
4) A process id would be nice (so you could track back to the system)
5) The InputStream(s) available() member does not work.
Finally, I later realized that rather than putting the two threads
that are draining the std-err/out streams in a loop I could trigger
them when the caller calls isAlive() thereby reducing the wasted
cycles checking for output. One could also pool the byte arrays
used to read output - a necessary evil of the fact that available
doesn't work.
Constructor Summary |
ARProcess()
Deprecated. |
ARProcess(java.lang.String[] args)
Deprecated. |
Method Summary |
java.lang.String[] |
arguments()
Deprecated. |
int |
exitCode()
Deprecated. |
boolean |
isAlive()
Deprecated. |
void |
kill()
Deprecated. |
boolean |
launch()
Deprecated. |
java.lang.String |
outputString()
Deprecated. |
java.lang.Process |
process()
Deprecated. |
void |
setArguments(java.lang.String args)
Deprecated. Of course this is only meaningful to the next call to launch() |
void |
setArguments(java.lang.String[] args)
Deprecated. Of course this is only meaningful to the next call to launch() |
java.lang.String |
standardErrorString()
Deprecated. |
java.lang.String |
standardOutputString()
Deprecated. |
void |
waitFor()
Deprecated. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ARProcess
public ARProcess(java.lang.String[] args)
- Deprecated.
ARProcess
public ARProcess()
- Deprecated.
arguments
public java.lang.String[] arguments()
- Deprecated.
setArguments
public void setArguments(java.lang.String[] args)
- Deprecated.
- Of course this is only meaningful to the next call to launch()
setArguments
public void setArguments(java.lang.String args)
- Deprecated.
- Of course this is only meaningful to the next call to launch()
launch
public boolean launch()
- Deprecated.
process
public java.lang.Process process()
- Deprecated.
isAlive
public boolean isAlive()
- Deprecated.
kill
public void kill()
- Deprecated.
waitFor
public void waitFor()
- Deprecated.
exitCode
public int exitCode()
- Deprecated.
outputString
public java.lang.String outputString()
- Deprecated.
standardOutputString
public java.lang.String standardOutputString()
- Deprecated.
standardErrorString
public java.lang.String standardErrorString()
- Deprecated.
AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.