Class NativeSignalHandler

java.lang.Object
org.jline.terminal.impl.NativeSignalHandler
All Implemented Interfaces:
Terminal.SignalHandler

public final class NativeSignalHandler extends Object implements Terminal.SignalHandler
Implementation of SignalHandler for native signal handling.

The NativeSignalHandler class provides an implementation of the SignalHandler interface that represents native signal handlers. It defines two special instances that correspond to the standard POSIX signal dispositions:

  • SIG_DFL - The default signal handler
  • SIG_IGN - The signal handler that ignores the signal

This class is used internally by terminal implementations to represent native signal handlers. It cannot be instantiated directly, and its handle(Signal) method throws an UnsupportedOperationException because native signal handling is performed by the underlying platform, not by Java code.

See Also:
  • Field Details

    • SIG_DFL

      public static final NativeSignalHandler SIG_DFL
      The default signal handler.

      This constant represents the default signal handler, which corresponds to the SIG_DFL disposition in POSIX systems. When a signal is handled by the default handler, the default action for that signal is taken, which varies depending on the signal (e.g., termination, core dump, ignore, etc.).

    • SIG_IGN

      public static final NativeSignalHandler SIG_IGN
      The signal handler that ignores signals.

      This constant represents the signal handler that ignores signals, which corresponds to the SIG_IGN disposition in POSIX systems. When a signal is handled by this handler, the signal is ignored and no action is taken.

  • Method Details

    • handle

      public void handle(Terminal.Signal signal)
      Handles the specified signal.

      This method always throws an UnsupportedOperationException because native signal handling is performed by the underlying platform, not by Java code. The NativeSignalHandler instances are only used as markers to indicate which native signal handler should be used.

      Specified by:
      handle in interface Terminal.SignalHandler
      Parameters:
      signal - the signal to handle
      Throws:
      UnsupportedOperationException - always thrown to indicate that this method cannot be called directly