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

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 7 09:15:36 UTC 2012


On 07/08/2012 04:35, David Holmes wrote:
>
> The change is harmless but as far as I can see you would have to 
> customize the VM before this change would have any affect. The signals 
> involved here are the SHUTDOWNn_SIGNAL values (which for linux/solaris 
> are HUP, INT and TERM). JVM_RegisterSignal simply does:
>
>     case SHUTDOWN1_SIGNAL:
>     case SHUTDOWN2_SIGNAL:
>     case SHUTDOWN3_SIGNAL:
>       if (ReduceSignalUsage) return (void*)-1;
>       if (os::Linux::is_sig_ignored(sig)) return (void*)1;
>   }
>
> So with -Xrs all values will get rejected as a group. As far as I can 
> see this is the only time that -1 will be returned to Signal.handle0 
> and hence the only circumstance where IllegalArgumentException will be 
> thrown. So without customizing the VM if any of these signals cause 
> IllegalArgumentException then they all will and hence having distinct 
> try/catch blocks for each is pointless.
>
> Did I miss something?
I agree with David and I think this thread is just missing an 
explanation as to how you ran into this. It this AIX and -Xrs is mapped 
to a different set of signals, maybe it was an observation when reading 
the code??

-Alan.



More information about the core-libs-dev mailing list