Hi Anthony,

On 2/10/2015 2:12 PM, Anthony Vanelverdinghe wrote:
Hi Roger

This looks great already. My feedback is about process destruction:

Why isn't ProcessHandle::isDestroyForcible a static method?
The Process API is subclassable and in that case the subclass
should be able to control that behavior.  When the specification refers to
implementation dependent it refers to the classes that implement Process.
The built-in ProcessBuilder and Runtime.exec that uses ProcessBuilder
define their implementation behaviors.


For ProcessHandle::destroy and Process::destroy, I'd like to propose replacing "Whether the process represented by this Process object is forcibly terminated or not is implementation dependent."
with:
"The process represented by this Process object is forcibly terminated if and only if isDestroyForcible returns true."
There is some API history to contend with and multiple implementations are possible. An application library can provide a factory of Process instances with other kinds of behavior.


Process::destroyForcibly contains the following phrase: "The default implementation of this method invokes destroy() and so may not forcibly terminate the process." Why doesn't the default implementation throw UnsupportedOperationException if forcible termination is not supported on/implemented for the current platform? If I write code like: process.destroyForcibly().waitFor(), I'd assume it would finish in a timely manner, but due to the default implementation, this may actually not finish at all.
The evolution of the Process API has been long and uneven. Destroy came first but was not predictable; the destroyForcibly was added but destroy remained backward compatible (and still must be backward compatible).

Roger


Kind regards, Anthony


On 10/02/2015 0:25, Roger Riggs 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







Reply via email to