F
Name: krC82822 Date: 04/18/2001
[18 Apr 2001, eval1127@eng -- filing this under classes_lang
because, while motivated by a JDI/JPDA issue, the requested
changes must be made in Process]
java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)
I'm launching new VirtualMachine instances by calling
com.sun.jdi.connect.LaunchingConnector.launch( java.util.Map )
The documentation for this method states:
( at http://java.sun.com/j2se/1.3/docs/guide/jpda/jdi/index.html )
"Important note: If a target VM is launched through this function, its output
and error streams must be read as it executes. These streams are available
through the Process object returned by VirtualMachine.process(). If the streams
are not periodically read, the target VM will stop executing when the buffers
for these streams are filled."
Fine, so I call VirtualMachine.process() and then periodically call
Process.getOutputStream().flush() to empty the buffer, and likewise with the
error stream.
However, it is highly desirable to simply redirect the output and error
streams of a given Process. For example, from my JDI application, call
Process.setOutputStream( System.out ) and Process.setErrorStream( System.err )
This would require the addition of these two methods to java.lang.Process
Furthermore, it would be even more desireable to get notification of events in
the streams of a given Process... this could be implemented in the stream API,
or the process API; either way, something to allow for notification that the
stream buffers have received data. That way, my application will automatically
flush them, but only when needed, not periodically as the documentation for
com.sun.jdi.connect.LaunchingConnector.launch( java.util.Map ) would impose.
If the JPDA is to become a full fledged standard, silly things like periodic
polling of a launched Process's output stream will have to go.
(Review ID: 120960)
======================================================================