TsBiff 1.3


ts.biff
Class TerminateController

java.lang.Object
  |
  +--ts.biff.TerminateController
All Implemented Interfaces:
java.lang.Runnable

public final class TerminateController
extends java.lang.Object
implements java.lang.Runnable

This class observes objects that implements the SafeTerminate interface. Objects should call the exit method in this class, instead of calling System.exit(), to do a controlled termination of the application.

Version:
$Id: TerminateController.java,v 1.8 1999/11/28 06:02:59 hauk Exp $
Author:
Jan-Henrik Haukeland <hauk@tildeslash.com>
See Also:
SafeTerminate

Method Summary
static void add(SafeTerminate s)
          Add an object to be controlled
static boolean canExit()
          Returns true if all objects managed by this controller agrees that it's safe to exit.
static TerminateController createController()
          Create the controller and return a reference to it.
static void exit()
          Do a controlled System.exit(0).
static void exit(int status)
          Do a controlled System.exit(n).
static void remove(SafeTerminate s)
          Remove an object from the controller
 void run()
          Loop trough all objects managed by this controller and if it's safe to exit do a System.exit(0).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createController

public static TerminateController createController()
Create the controller and return a reference to it.

add

public static void add(SafeTerminate s)
Add an object to be controlled
Parameters:
A - SafeTerminate object

remove

public static void remove(SafeTerminate s)
Remove an object from the controller
Parameters:
A - SafeTerminate object

canExit

public static boolean canExit()
Returns true if all objects managed by this controller agrees that it's safe to exit. Calls canTerminate() for all objects managed by this controller and return the logical AND of their return values.
Returns:
True if safe to exit

run

public void run()
Loop trough all objects managed by this controller and if it's safe to exit do a System.exit(0). If the exit is forced because of a Timeout, do a System.exit(1) and print a warning message.
Specified by:
run in interface java.lang.Runnable

exit

public static void exit()
Do a controlled System.exit(0).

exit

public static void exit(int status)
Do a controlled System.exit(n).

TsBiff 1.3