javax.realtime
Class POSIXSignalHandler

java.lang.Object
  extended byjavax.realtime.POSIXSignalHandler

public final class POSIXSignalHandler
extends java.lang.Object

Use instances of AsyncEventHandler to handle POSIX signals. Usage:

POSIXSignalHandler.addHandler(SIGINT, intHandler);
This class is required to be implemented only if the underlying operating system supports POSIX signals.

POSIX requires the implementation to support 13 non-real-time signals and it names 12 additional optional signals. This class mirrors that practice. Except for the 13 signals required by POSIX, support for a signal in this class does not imply that it is generated by the runtime system.


Field Summary
static int SIGABRT
          Used by abort.
static int SIGALRM
          Alarm clock.
static int SIGBUS
          Bus error.
static int SIGCANCEL
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGCHLD
          Child status change alias.
static int SIGCLD
          Child status change.
static int SIGCONT
          Stopped process has been continued.
static int SIGEMT
          EMT instruction.
static int SIGFPE
          Floating point exception.
static int SIGFREEZE
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGHUP
          Hang-up.
static int SIGILL
          Illegal instruction (not reset when caught).
static int SIGINT
          Interrupt (rubout).
static int SIGIO
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGIOT
          IOT instruction.
static int SIGKILL
          Kill (cannot be caught or ignored).
static int SIGLOST
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGLWP
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGPIPE
          Write on a pipe with no one to read it.
static int SIGPOLL
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGPROF
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGPWR
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGQUIT
          Quit (ASCII FS).
static int SIGSEGV
          Segmentation violation.
static int SIGSTOP
          Stop (cannot be caught or ignored).
static int SIGSYS
          Bad argument to system call.
static int SIGTERM
          Software termination signal from kill.
static int SIGTHAW
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGTRAP
          Trace trap.
static int SIGTSTP
          User stop requested from TTY.
static int SIGTTIN
          Background tty read attempted.
static int SIGTTOU
          Background tty write attempted.
static int SIGURG
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGUSR1
          User defined signal 1.
static int SIGUSR2
          User defined signal 2.
static int SIGVTALRM
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGWAITING
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGWINCH
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGXCPU
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
static int SIGXFSZ
          Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.
 
Method Summary
static void addHandler(int signal, AsyncEventHandler handler)
          Add the given AsyncEventHandler to the list of handlers of the given signal.
static void removeHandler(int signal, AsyncEventHandler handler)
          Remove the given AsyncEventHandler from the list of handlers of the given signal.
static void setHandler(int signal, AsyncEventHandler handler)
          Set the given AsyncEventHandler as the handler of the given signal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGABRT

public static final int SIGABRT
Used by abort.

See Also:
Constant Field Values

SIGALRM

public static final int SIGALRM
Alarm clock.

See Also:
Constant Field Values

SIGBUS

public static final int SIGBUS
Bus error.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGCANCEL

public static final int SIGCANCEL
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Thread cancellation signal used by libthread.

See Also:
Constant Field Values

SIGCHLD

public static final int SIGCHLD
Child status change alias.

See Also:
Constant Field Values

SIGCLD

public static final int SIGCLD
Child status change.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGCONT

public static final int SIGCONT
Stopped process has been continued.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGEMT

public static final int SIGEMT
EMT instruction.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGFPE

public static final int SIGFPE
Floating point exception.

See Also:
Constant Field Values

SIGFREEZE

public static final int SIGFREEZE
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Special signal used by CPR.

See Also:
Constant Field Values

SIGHUP

public static final int SIGHUP
Hang-up.

See Also:
Constant Field Values

SIGILL

public static final int SIGILL
Illegal instruction (not reset when caught).

See Also:
Constant Field Values

SIGINT

public static final int SIGINT
Interrupt (rubout).

See Also:
Constant Field Values

SIGIO

public static final int SIGIO
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Socket I/O possible (SIGPOLL alias).

See Also:
Constant Field Values

SIGIOT

public static final int SIGIOT
IOT instruction.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGKILL

public static final int SIGKILL
Kill (cannot be caught or ignored).

See Also:
Constant Field Values

SIGLOST

public static final int SIGLOST
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Resource lost (e.g., record-lock lost).

See Also:
Constant Field Values

SIGLWP

public static final int SIGLWP
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Special signal used by thread library.

See Also:
Constant Field Values

SIGPIPE

public static final int SIGPIPE
Write on a pipe with no one to read it.

See Also:
Constant Field Values

SIGPOLL

public static final int SIGPOLL
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Pollable event occurred.

See Also:
Constant Field Values

SIGPROF

public static final int SIGPROF
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Profiling timer expired.

See Also:
Constant Field Values

SIGPWR

public static final int SIGPWR
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Power-fail restart.

See Also:
Constant Field Values

SIGQUIT

public static final int SIGQUIT
Quit (ASCII FS).

See Also:
Constant Field Values

SIGSEGV

public static final int SIGSEGV
Segmentation violation.

See Also:
Constant Field Values

SIGSTOP

public static final int SIGSTOP
Stop (cannot be caught or ignored).

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGSYS

public static final int SIGSYS
Bad argument to system call.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGTERM

public static final int SIGTERM
Software termination signal from kill.

See Also:
Constant Field Values

SIGTHAW

public static final int SIGTHAW
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Special signal used by CPR.

See Also:
Constant Field Values

SIGTRAP

public static final int SIGTRAP
Trace trap.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGTSTP

public static final int SIGTSTP
User stop requested from TTY.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGTTIN

public static final int SIGTTIN
Background tty read attempted.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGTTOU

public static final int SIGTTOU
Background tty write attempted.

This is an optional POSIX signal.

See Also:
Constant Field Values

SIGURG

public static final int SIGURG
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Urgent socket condition.

See Also:
Constant Field Values

SIGUSR1

public static final int SIGUSR1
User defined signal 1.

See Also:
Constant Field Values

SIGUSR2

public static final int SIGUSR2
User defined signal 2.

See Also:
Constant Field Values

SIGVTALRM

public static final int SIGVTALRM
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Virtual timer expired.

See Also:
Constant Field Values

SIGWAITING

public static final int SIGWAITING
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Process's light-weight processes are blocked.

See Also:
Constant Field Values

SIGWINCH

public static final int SIGWINCH
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Window size change.

See Also:
Constant Field Values

SIGXCPU

public static final int SIGXCPU
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Exceeded cpu limit.

See Also:
Constant Field Values

SIGXFSZ

public static final int SIGXFSZ
Deprecated. 1.0.1 This signal is not mentioned in the POSIX 9945-1-1996 standard.

Exceeded file size limit.

See Also:
Constant Field Values
Method Detail

addHandler

public static void addHandler(int signal,
                              AsyncEventHandler handler)
Add the given AsyncEventHandler to the list of handlers of the given signal.

Parameters:
signal - One of the POSIX signals from this (e.g., this.SIGINT). If the value given to signal is not one of the those defined by this class then an IllegalArgumentException will be thrown.
handler - An AsyncEventHandler which will be scheduled when the given signal occurs.
Throws:
java.lang.IllegalArgumentException - Thrown if signal is not known by this class or if handler is null.
java.lang.UnsupportedOperationException - Thrown if signal is known to this class, but not supported on this implementation.

removeHandler

public static void removeHandler(int signal,
                                 AsyncEventHandler handler)
Remove the given AsyncEventHandler from the list of handlers of the given signal.

Parameters:
signal - One of the POSIX signals from this (e.g., this.SIGINT). If the value given to signal is not one of the POSIX signals then an IllegalArgumentException will be thrown.
handler - An AsyncEventHandler which will be scheduled when the given signal occurs.
Throws:
java.lang.IllegalArgumentException - Thrown if signal is not known by this class or if handler is null.

setHandler

public static void setHandler(int signal,
                              AsyncEventHandler handler)
Set the given AsyncEventHandler as the handler of the given signal.

Parameters:
signal - One of the POSIX signals from this (e.g., this.SIGLOST). If the value given to signal is not one of the POSIX signals then an IllegalArgumentException will be thrown.
handler - An AsyncEventHandler which will be scheduled when the given signal occurs. If h is null then no handler will be associated with this (i.e., remove all handlers).
Throws:
java.lang.IllegalArgumentException - Thrown if signal is not known by this class.
java.lang.UnsupportedOperationException - Thrown if signal is known to this class, but not supported on this implementation.