Examples of Signal


Examples of sun.misc.Signal

        handler = sh;
        // When -Xrs is specified the user is responsible for
        // ensuring that shutdown hooks are run by calling
        // System.exit()
        try {
            Signal.handle(new Signal("HUP"), sh);
        } catch (IllegalArgumentException e) {
        }
        try {
            Signal.handle(new Signal("INT"), sh);
        } catch (IllegalArgumentException e) {
        }
        try {
            Signal.handle(new Signal("TERM"), sh);
        } catch (IllegalArgumentException e) {
        }
    }
View Full Code Here

Examples of sun.misc.Signal

    {
        this(parseConfig(configurationURL));
        _configFile = configurationURL;
        try
        {
            Signal sig = new sun.misc.Signal("HUP");
            sun.misc.Signal.handle(sig, this);
        }
        catch (IllegalArgumentException e)
        {
            // We're on something that doesn't handle SIGHUP, how sad, Windows.
View Full Code Here

Examples of sun.misc.Signal

        return trap(runtime, new JRubySignalHandler(runtime, blk, sig));
    }

    private IRubyObject trap(final Ruby runtime, final JRubySignalHandler handler) {
        final SignalHandler oldHandler;
        final Signal signal;

        try {
            signal = new Signal(handler.signal);
        } catch (Throwable e) {
            return runtime.getNil();
        }

        try {
            oldHandler = Signal.handle(signal, handler);
        } catch (Exception e) {
            throw runtime.newArgumentError(e.getMessage());
        }

        BlockCallback callback = null;
        if (oldHandler instanceof JRubySignalHandler) {
            JRubySignalHandler jsHandler = (JRubySignalHandler) oldHandler;
            if (jsHandler.blockCallback != null) {
                callback = jsHandler.blockCallback;
            } else {
                return jsHandler.block;
            }
        }
        if (callback == null) {
            callback = new BlockCallback() {
                public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
                    oldHandler.handle(new Signal(handler.signal));
                    return runtime.getNil();
                }
            };
        }
        final RubyModule signalModule = runtime.getModule("Signal");
View Full Code Here

Examples of sun.misc.Signal

                        .callMethod(context, "raise", e.getException());
                } catch(Exception ignored) {}
            } catch (MainExitException mee) {
                runtime.getThreadService().getMainThread().kill();
            } finally {
                Signal.handle(new Signal(this.signal), this);
            }
        }
View Full Code Here

Examples of sun.misc.Signal

   *          returning -1
   * @return 0 if ok
   */
  public int processLine(String line, boolean allowInterupting) {
    SignalHandler oldSignal = null;
    Signal interupSignal = null;

    if (allowInterupting) {
      // Remember all threads that were running at the time we started line processing.
      // Hook up the custom Ctrl+C handler while processing this line
      interupSignal = new Signal("INT");
      oldSignal = Signal.handle(interupSignal, new SignalHandler() {
        private final Thread cliThread = Thread.currentThread();
        private boolean interruptRequested;

        @Override
View Full Code Here

Examples of sun.misc.Signal

        if (handler._oldHandler != null) {
            Log.util.warning(9158, handler, signalName);
            return null;
        }
        try {
            Signal signal = new Signal(signalName);
            handler._oldHandler = Signal.handle(signal, handler);
        }
        catch (IllegalArgumentException e) {
            Log.util.warning(9159, handler, signalName, e.getMessage());
            return null;
View Full Code Here

Examples of sun.misc.Signal

     * @aribaapi ariba
     */
    public static void raiseSignal (String signalName)
    {
        try {
            Signal signal = new Signal(signalName)
            Signal.raise(signal);
        }
        catch (IllegalArgumentException e) {
            Log.util.warning(9160, signalName, e.getMessage());
        }
View Full Code Here

Examples of sun.misc.Signal

   */
  public IrqHandler(String name, Interrupted handler) throws IOException {
    this.handler = handler;
    this.name = name;
    try {
      Signal.handle(new Signal(name), this);
    } catch (IllegalArgumentException e) {
      throw new IOException(
        "Could not set handler for signal \"" + name + "\"."
        + "This can happen if the JVM has the -Xrs set.",
        e);
View Full Code Here

Examples of sun.misc.Signal

   *          returning -1
   * @return
   */
  public int processLine(String line, boolean allowInterupting) {
    SignalHandler oldSignal = null;
    Signal interupSignal = null;

    if (allowInterupting) {
      // Remember all threads that were running at the time we started line processing.
      // Hook up the custom Ctrl+C handler while processing this line
      interupSignal = new Signal("INT");
      oldSignal = Signal.handle(interupSignal, new SignalHandler() {
        private final Thread cliThread = Thread.currentThread();
        private boolean interruptRequested;

        @Override
View Full Code Here

Examples of sun.misc.Signal

            handler.handle(signal.getNumber());
        }
    }
   
    public SignalHandler signal(jnr.constants.platform.Signal sig, final SignalHandler handler) {
        Signal s = new Signal(sig.name().substring("SIG".length()));
       
        sun.misc.SignalHandler oldHandler = Signal.handle(s, new SunMiscSignalHandler(handler));
       
        if (oldHandler instanceof SunMiscSignalHandler) {
            return ((SunMiscSignalHandler)oldHandler).handler;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.