com.ibm.wbi.util
Class Signal

java.lang.Object
  |
  +--com.ibm.wbi.util.Signal

public class Signal
extends java.lang.Object

Provide operating system signal handling for a Java VM. Classes that wish to be notified about signals should implement SignalListener and add themselves to the listener list by calling Signal.addSignalListener( SignalListener ). To stop receiving signal events, SignalListeners may remove themselves by calling Signal.removeSignalListener( SignalListener ).


Field Summary
protected static java.util.Vector listeners
          list of SignalListeners that wish to receive SignalEvents when signal occur
protected static boolean registered
          keep track of whether our signal handler has been registered with the operating system or not
 
Constructor Summary
Signal()
          dummy constructor so that SignalEvents can have a source, which will be a dummy instance of Signal
 
Method Summary
static void addSignalListener(SignalListener sl)
          adds a SignalListener to the list of listeners to receive SignalEvents.
static java.util.Enumeration getSignalListeners()
          retrieve an enumeration of all the signal listeners
protected static boolean isEnabled(int type)
          a callback that the native signal handler uses to determine whether the signal should be passed to SignalListeners for handling or should be handled by the operating system.
protected static void registerSignal(int signal)
          native method that registers a signal handler for the given signal type
static void removeSignalListener(SignalListener sl)
          removes a SignalListener from the list of listeners to receive SignalEvents
protected static void signalCaught(int signal)
          method called by the operating system whenever a signal occurs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

registered

protected static boolean registered
keep track of whether our signal handler has been registered with the operating system or not

listeners

protected static java.util.Vector listeners
list of SignalListeners that wish to receive SignalEvents when signal occur
Constructor Detail

Signal

public Signal()
dummy constructor so that SignalEvents can have a source, which will be a dummy instance of Signal
Method Detail

registerSignal

protected static void registerSignal(int signal)
native method that registers a signal handler for the given signal type
Parameters:
signal - the signal type (see SignalEvent for a list of signal types)

signalCaught

protected static void signalCaught(int signal)
method called by the operating system whenever a signal occurs
Parameters:
signal - the type of signal that has occurred

isEnabled

protected static boolean isEnabled(int type)
a callback that the native signal handler uses to determine whether the signal should be passed to SignalListeners for handling or should be handled by the operating system.
Parameters:
signal - the type of signal that has occurred

addSignalListener

public static void addSignalListener(SignalListener sl)
adds a SignalListener to the list of listeners to receive SignalEvents. Posts a RAS trace message if the native link cannot be satisfied, but otherwise gives no hint that something is wrong.
Parameters:
the - listener to add to the list

removeSignalListener

public static void removeSignalListener(SignalListener sl)
removes a SignalListener from the list of listeners to receive SignalEvents
Parameters:
the - listener to remove from the list

getSignalListeners

public static java.util.Enumeration getSignalListeners()
retrieve an enumeration of all the signal listeners
Returns:
an enumeration of all the signal listeners