Hi Staffan,
On 2/10/2015 4:53 AM, Staffan Larsen wrote:
Happy to see this!
In ProcessHandle.Info would it be possible to include the environment variables
of the process as well?
The API was intended to provide a degree of control over subprocesses,
but not
be a diagnostic tool, there are better os specific tools for those
purposes.
On some systems getting current information requires reading the
processes memory image
and that's a fragile mechanism that I don't think it is worth coding and
maintaining.
There is also a risk of duplicating the functions of java.lang.management.
Can access to the environment can be supported in that API?
It is easier and more reliable to retrieve that kind of information
from inside of the process.
How does ProcessHandle.allChildren() behave when process A launches B which
launches C, and B terminates? Is C included in allChildren() of A?
Whatever the OS does. The implementation makes a best effort at a
snapshot of the processes
that exist at the time the method is called. Depending on the OS the
snapshot may or may not
get a consistent view. For example, on Unix, /proc/nnn is read and each
process is opened to
get its parent. The set of processes and the parentage can change
during that process.
And the parent/child relationships can change after that, processes can
be created or terminate at any time.
Roger
Thanks,
/Staffan
On 10 feb 2015, at 00:25, Roger Riggs <roger.ri...@oracle.com> wrote:
Hi,
After a protracted absence from working on JEP 102, the updated API draft
provides access to process hierarchies and individual process information;
as permitted by the OS. The relationship between Process and ProcessHandle
is clarified and the security model validated.
Both Processes and ProcessHandles can be monitored using CompletableFuture
for termination and to trigger additional actions on Process exit.
Information about processes includes the total cputime, starttime, user,
executable, and arguments.
Please review and comment:
http://cr.openjdk.java.net/~rriggs/ph-apidraft/
Thanks, Roger