org.opengts.util
Class PosixSignalHandler

java.lang.Object
  extended by org.opengts.util.PosixSignalHandler

public class PosixSignalHandler
extends java.lang.Object

Posix Signal Handler. This class requires the availability of the "sun.misc.SignalHandler" class for both compiling and running.


Field Summary
static java.lang.String SIGNAL_ABRT
           
static java.lang.String SIGNAL_HUP
           
static java.lang.String SIGNAL_INT
           
static java.lang.String[] SIGNAL_LIST
           
static java.lang.String SIGNAL_TERM
           
 
Constructor Summary
PosixSignalHandler()
          Constructor
PosixSignalHandler(java.lang.String... sigs)
          Constructor
 
Method Summary
 boolean _handleSignal(java.lang.String sigName)
          set up a signal handler callback for the specified/named signal (should be one of "HUP", "INT"(^C), "ABRT", "TERM")
 boolean handleSignal(java.lang.String... sigNames)
          set up a signal handler callback for the specified/named signal (should be one of "HUP", "INT"(^C), "ABRT", "TERM")
static boolean isValidSignalNames(java.lang.String... sigs)
           
static void main(java.lang.String[] argv)
           
protected  void signal_ABRT()
          "ABRT" signal callback
protected  void signal_HUP()
          "HUP" signal callback
protected  void signal_INT()
          "INT" signal callback
protected  void signal_TERM()
          "TERM" signal callback
protected  void signal(java.lang.String sigName)
          overridable handler callback
 boolean sunSignalHandlerAvailable()
          Returns true if the "sun.misc.Signal" is available
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGNAL_HUP

public static final java.lang.String SIGNAL_HUP
See Also:
Constant Field Values

SIGNAL_INT

public static final java.lang.String SIGNAL_INT
See Also:
Constant Field Values

SIGNAL_TERM

public static final java.lang.String SIGNAL_TERM
See Also:
Constant Field Values

SIGNAL_ABRT

public static final java.lang.String SIGNAL_ABRT
See Also:
Constant Field Values

SIGNAL_LIST

public static final java.lang.String[] SIGNAL_LIST
Constructor Detail

PosixSignalHandler

public PosixSignalHandler()
Constructor


PosixSignalHandler

public PosixSignalHandler(java.lang.String... sigs)
                   throws java.lang.IllegalArgumentException
Constructor

Parameters:
sigs - List of signals
Throws:
java.lang.IllegalArgumentException - if a specified signal name is invalid
Method Detail

isValidSignalNames

public static boolean isValidSignalNames(java.lang.String... sigs)

sunSignalHandlerAvailable

public boolean sunSignalHandlerAvailable()
Returns true if the "sun.misc.Signal" is available

Returns:
True if the "sun.misc.Signal" is available

handleSignal

public boolean handleSignal(java.lang.String... sigNames)
                     throws java.lang.IllegalArgumentException
set up a signal handler callback for the specified/named signal (should be one of "HUP", "INT"(^C), "ABRT", "TERM")

Parameters:
sigNames - List of signal names
Returns:
True if the signal was successfully handled, false if "sun.misc.Signal" is not available.
Throws:
java.lang.IllegalArgumentException - if a specified signal name is invalid

_handleSignal

public boolean _handleSignal(java.lang.String sigName)
                      throws java.lang.IllegalArgumentException
set up a signal handler callback for the specified/named signal (should be one of "HUP", "INT"(^C), "ABRT", "TERM")

Parameters:
sigName - The signal name
Returns:
True if the signal was successfully handled, false if "sun.misc.Signal" is not available.
Throws:
java.lang.IllegalArgumentException - if the specified signal name is invalid

signal

protected void signal(java.lang.String sigName)
overridable handler callback


signal_HUP

protected void signal_HUP()
"HUP" signal callback


signal_INT

protected void signal_INT()
"INT" signal callback


signal_ABRT

protected void signal_ABRT()
"ABRT" signal callback


signal_TERM

protected void signal_TERM()
"TERM" signal callback


main

public static void main(java.lang.String[] argv)