Improve registering signal handlers in java.lang.Terminator.setup()

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 7 17:01:13 UTC 2012


On 07/08/2012 15:02, Neil Richards wrote:
> :
> > From a Java Class Library point of view, it seems to me that the desire
> is to register shutdown hooks for any of these signals (HUP, INT and
> TERM) whose use has not been restricted by the VM.
>
> So an attempt to register for each of these signals should be made,
> independent of the result of any of the other attempts.
>
> To do anything else builds into the Java class library code assumptions
> about the behaviour of the VM which are inherently implementation
> (version?) specific, which is a brittle thing to do.
>
> It currently assumes that the VM will either have restricted all these
> signals (the -Xrs case) or none of them.
>
> This assumption holds true for the current version of Hotspot VM, but
> not necessarily for other VM implementations, whose mix of signal usage
> may differ.
>
> So I think Frank's suggested change helps this code to adhere the VM /
> Class Library interface boundary, and so makes it less brittle.
>
As David said, the proposed change is harmless and I don't think anyone 
has any issue with it. It's really just us trying to understand whether 
there is really an issue here or not as it is has not been clear from 
the mails so far. I'm guessing it's AIX or J9 where -Xrs may be mapped 
to a different set of signals. FWIW, the termination setup has not been 
touched in >10 years. Looking at it now then it could have been done in 
other ways that wouldn't have been VM specific. Whether it's worth doing 
this now isn't clear as it just hasn't been an issue (to my knowledge 
anyway).

-Alan



More information about the core-libs-dev mailing list