Class NativeSignalHandler
- java.lang.Object
-
- org.jline.terminal.impl.NativeSignalHandler
-
- All Implemented Interfaces:
Terminal.SignalHandler
public final class NativeSignalHandler extends java.lang.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:
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.
-
-
Field Summary
Fields Modifier and Type Field Description static NativeSignalHandler
SIG_DFL
The default signal handler.static NativeSignalHandler
SIG_IGN
The signal handler that ignores signals.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handle(Terminal.Signal signal)
Handles the specified signal.
-
-
-
Field Detail
-
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 Detail
-
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 interfaceTerminal.SignalHandler
- Parameters:
signal
- the signal to handle- Throws:
java.lang.UnsupportedOperationException
- always thrown to indicate that this method cannot be called directly
-
-