RFR 9: 8077350 Process API Updates Implementation Review

Roger Riggs Roger.Riggs at Oracle.com
Wed May 13 15:10:57 UTC 2015


Hi Alan,

Yes, the destroy use looks a bit odd. In Process, destroyForcibly
returns this so that the application can fluently wait for the 
termination to complete.
Returning Optional<ProcessHandle> enables the case to fluently
perform an action on the process when it does exit.

     ProcessHandle ph = ...;
     ph.destroy().ifPresent(p -> p.onExit( ...));

Optional.isPresent() provides a boolean if that's needed.

Thanks, Roger


On 5/13/2015 10:55 AM, Alan Bateman wrote:
> On 13/05/2015 15:16, Roger Riggs wrote:
>> Hi,
>>
>> Are there any comments about the use of java.util.Optional in the 
>> ProcessHandle API?
>> Or a review of the changes?
> Having parent return Optional<ProcessHandle> looks good.
>
> Having all methods in ProcessHandle.Info return Optional is probably 
> right, it gives us a bit more flexibility compared to info() returning 
> Optional<Info>.
>
> I'm not sure abut the destroy* methods, the result of a destroy is 
> essentially a boolean so this feels a little odd.
>
> -Alan.




More information about the core-libs-dev mailing list