Class NativeSignalHandler
- All Implemented Interfaces:
Terminal.SignalHandler
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NativeSignalHandler
The default signal handler.static final NativeSignalHandler
The signal handler that ignores signals. -
Method Summary
Modifier and TypeMethodDescriptionvoid
handle
(Terminal.Signal signal) Handles the specified signal.
-
Field Details
-
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
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
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:
UnsupportedOperationException
- always thrown to indicate that this method cannot be called directly
-