Package sun.misc

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 (Exception e)
        {
            _logger.error("Signal HUP not supported for OS: " + System.getProperty("os.name"));
View Full Code Here


    }

    public IRubyObject restorePlatformDefault(IRubyObject recv, IRubyObject sig) {
        SignalHandler handler;
        synchronized (original) {
            handler = original.get(new Signal(sig.toString()));
        }
        if (handler!=null)
            return trap(recv.getRuntime(),sig.toString(),handler);
        else {
            // JRuby hasn't touched this signal handler, so it should be the platform default already
View Full Code Here

        return trap(recv.getRuntime(),sig.toString(),SignalHandler.SIG_IGN);
    }

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

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

        try {
View Full Code Here

                        .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

    public static void register(ShellBase shell) {
        handlerShell = shell;
        handlers = new Stack();

        Signal signal;
        try {
            signal = new Signal("INT");
        } catch (IllegalArgumentException e) {
            return; //e.g NetWare
        }

        try {
View Full Code Here

   *          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

  private Statement stmt = null;

  SunSignalHandler () {
    // Interpret Ctrl+C as a request to cancel the currently
    // executing query.
    Signal.handle (new Signal ("INT"), this);
  }
View Full Code Here

        @Specialization
        public Object trap(RubyString signalName, UndefinedPlaceholder command, final RubyProc block) {
            notDesignedForCompilation();

            final Signal signal = new Signal(signalName.toString());

            final SignalHandler newHandler = new ProcSignalHandler(block);
            final SignalHandler oldHandler = Signal.handle(signal, newHandler);

            if (oldHandler instanceof ProcSignalHandler) {
View Full Code Here

    public IRubyObject restorePlatformDefault(IRubyObject recv, IRubyObject sig) {
        SignalHandler handler;
        Ruby runtime = recv.getRuntime();
        try {
            synchronized (original) {
                handler = original.get(new Signal(sig.toString()));
            }
        } catch (IllegalArgumentException e) {
            handler = null;
        }
        if (handler != null) {
View Full Code Here

    private IRubyObject trap(final Ruby runtime, final String signalName, final SignalHandler handler) {
        boolean handled;

        SignalHandler oldHandler;
        Signal signal;
        try {
            signal = new Signal(signalName);
            oldHandler = Signal.handle(signal, handler);
            synchronized (original) {
                if (!original.containsKey(signal))
                    original.put(signal, oldHandler);
            }
View Full Code Here

TOP

Related Classes of sun.misc.Signal

Copyright © 2018 www.massapicom. 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.