/** * <p> * Register for the given signal. Note that the signal name should * <b>not</b> begin with <b>SIG</b>. For example, if you are interested in * <b>SIGTERM</b>, you should call <code>register("TERM")</code>. * </p> * <p> * If the registration fails for any reason, a * <code>SignalInterceptorException</code> will be thrown. This is usually * caused by one of the following conditions: * </p> * <ul> * <li>The <code>sun.misc.Signal*</code> classes are not available (e.g. you * are not using Sun's JVM).</li> * <li><code>signame</code> is not a valid trappable signal name on this OS * (e.g. <b>KILL</b> can't be trapped, <b>HUP</b> does not exist on Windows) * </li> * <li>The JVM refuses to let you trap <code>signame</code> because it is * already being used for some other important purpose (e.g. <b>QUIT</b> * and/or <b>BREAK</b> cause the JVM to print diagnostic output).</li> * </ul> */ protected void register(String signame) throws SignalInterceptorException { try { new SignalInterceptorHelper(signame, this); } catch (Throwable e) { throw new SignalInterceptorException(signame, e); } }
/** * <p> * Register for the given signal. Note that the signal name should * <b>not</b> begin with <b>SIG</b>. For example, if you are interested in * <b>SIGTERM</b>, you should call <code>register("TERM")</code>. * </p> * <p> * If the registration fails for any reason, a * <code>SignalInterceptorException</code> will be thrown. This is usually * caused by one of the following conditions: * </p> * <ul> * <li>The <code>sun.misc.Signal*</code> classes are not available (e.g. you * are not using Sun's JVM).</li> * <li><code>signame</code> is not a valid trappable signal name on this OS * (e.g. <b>KILL</b> can't be trapped, <b>HUP</b> does not exist on Windows) * </li> * <li>The JVM refuses to let you trap <code>signame</code> because it is * already being used for some other important purpose (e.g. <b>QUIT</b> * and/or <b>BREAK</b> cause the JVM to print diagnostic output).</li> * </ul> */ protected void register(String signame) throws SignalInterceptorException { try { new SignalInterceptorHelper(signame, this); } catch (Throwable e) { throw new SignalInterceptorException(signame, e); } }