Package sun.misc

Examples of sun.misc.SignalHandler


    public InterruptHandler(Console console) {
        this.console = console;
    }

    public void setupHandler() throws IOException {
         SignalHandler handler = new SignalHandler() {
             @Override
             public void handle(Signal sig) {
                 LOGGER.info("Got Signal: "+sig);
                 //console.get
             }
View Full Code Here


        this.client = checkNotNull(client, "client is null");
    }

    public void renderOutput(PrintStream out, OutputFormat outputFormat, boolean interactive)
    {
        SignalHandler oldHandler = Signal.handle(SIGINT, new SignalHandler()
        {
            @Override
            public void handle(Signal signal)
            {
                if (ignoreUserInterrupt.get() || client.isClosed()) {
View Full Code Here

@SuppressWarnings("restriction")
public class SigHandler
{
   public static void init(final ShellImpl shell)
   {
      SignalHandler interruptHandler = new SignalHandler()
      {
         @Override
         public void handle(final Signal signal)
         {
            shell.interrupt();
View Full Code Here

    final AtomicBoolean exitSignalTriggered = new AtomicBoolean(false);

    final AtomicReference<SignalHandler> existingExitHandler =
        new AtomicReference<SignalHandler>(null);

    final SignalHandler handler = new SignalHandler() {
      @Override
      public void handle(Signal signal) {
        if (exitSignalTriggered.get()) {
          System.err.println("Exiting with extreme prejudice due to " + signal);
          // Really exit
View Full Code Here

   *          When true the function will handle SIG_INT (Ctrl+C) by interrupting the processing and
   *          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
        public void handle(Signal signal) {
View Full Code Here

        public void signalReceived (Number number);
    }

    public static final void register (final Number number, final Handler handler)
    {
        Signal.handle(new Signal(number.toString()), new SignalHandler() {
            public void handle (Signal sig) {
                handler.signalReceived(number);
            }
        });
    }
View Full Code Here

TOP

Related Classes of sun.misc.SignalHandler

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.