On Mon, 4 Jul 2022 16:31:22 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> I reworded with the suggested text in mind. I also added another sentence 
>> referencing native signal handlers, which may also initiate shutdown. I 
>> think this clarification is important so that it is clear the status code of 
>> all invocations from Java may still be ignored. See 
>> [2253259](https://github.com/openjdk/jdk/pull/9351/commits/2253259c82b13e7b2186429a80cc42497235b035).
>
> I think the wording in the latest commit (9d972b) is problematic. One reason 
> is that you've changed it to "will run shutdown hooks" but it doesn't run the 
> hooks, it starts them, and so conflicts with the previous paragraph. I also 
> think "That invocation may be initiated via platform specific signal 
> handlers" is confusing here as there is no notion of "signal handler" to 
> reference. There may be scope for text elsewhere, maybe with an implNote for 
> signals such as HUP, but I don't think this is the PR for this. So I think it 
> better to try the wording that David suggested and see if it needs any 
> improvement.

YAO (Yet Another Opinion)!  But I think we're actually converging.

David's wording:
>Invocations of this method are serialized such that only one invocation will 
>actually proceed with the shutdown sequence and terminate the VM with the 
>given status code.

... gives the impression that an invocation of this method WILL terminate the 
VM with the given status code - which is not actually true, given the potential 
for signals. This is already alluded to in `Runtime::addShutdownHook`. I agree 
that this could be resolved separately, but we should _allow_ for it.
 
The original wording:
> If this method is invoked after all shutdown hooks have already been run ... 

... seems quite clever (and allows for signals). Maybe we could:
> If this method is invoked after shutdown hooks have already been started it 
> will block indefinitely. If this method is invoked from a shutdown hook the 
> system will deadlock.

-------------

PR: https://git.openjdk.org/jdk/pull/9351

Reply via email to