JEP 102 Process Updates revised API draft
Peter Levart
peter.levart at gmail.com
Wed Mar 11 11:34:32 UTC 2015
On 03/11/2015 11:29 AM, Chris Hegarty wrote:
> can be removed, no?
>> long getPID() throws USO { throw new USO; }
>
> I think ProcessHandle needs a protected constructor, otherwise it
> cannot be implemented outside of the platform. Or is this the intent?
> In which case Process.getPid() may need to remain.
I think in majority of cases it needs not be implemented outside the
platform. Process.getPid() can remain as a quick shortcut and by default
it can be implemented as:
public long getPid() throws USO {
return toHandle().getPid();
}
...and overridden in internal implementations with more optimal thing.
Ok, then the same can be said for Process.onExit() (which can now have a
different signature than ProcessHandle.onExit()):
public abstract class Process {
public CompletableFuture<Process> onExit() {
return toHandle().onExit().thenApply(ph -> this);
}
Peter
More information about the core-libs-dev
mailing list