com.mindtree.techworks.insight
Class ShutdownHookManager

java.lang.Object
  extended by com.mindtree.techworks.insight.ShutdownHookManager

public final class ShutdownHookManager
extends java.lang.Object

This class manages all actions that need to be performed when the application is being closed. All possible tasks are defined as constants in this class, and the class exposes public methods to register tasks that need to be performed on application shutdown.

The class registers a thread which monitors the runtime with a shutdown hook, and calls a method in this class when the runtime is going down. The method #shutDown checks for all registered actions requested (if any) and executes them.

Version:
$Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
Author:
Bindul Bhowmik

Field Summary
protected static int SHUTDOWN_ACTION
          Store of all actions that need to be performed on application shutdown.
static int SHUTDOWN_ACTION_CLEAR_PAGES
          Action identifier to call a clear on the PageSet, to clear the paginated data before the application is closed.
static int SHUTDOWN_ACTION_SAVE_PREFERENCES
          Action identifier to call a save on the Preference Manager before the application is closed.
 
Constructor Summary
ShutdownHookManager()
           
 
Method Summary
static void addShutdownAction(int shutdownAction)
          Register an action to be performed on shutdown of the application.
protected static void shutDown()
          Method called when the runtime is going down, all actions registered will be checked and performed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHUTDOWN_ACTION_SAVE_PREFERENCES

public static final int SHUTDOWN_ACTION_SAVE_PREFERENCES
Action identifier to call a save on the Preference Manager before the application is closed.

See Also:
Constant Field Values

SHUTDOWN_ACTION_CLEAR_PAGES

public static final int SHUTDOWN_ACTION_CLEAR_PAGES
Action identifier to call a clear on the PageSet, to clear the paginated data before the application is closed.

See Also:
Constant Field Values

SHUTDOWN_ACTION

protected static int SHUTDOWN_ACTION
Store of all actions that need to be performed on application shutdown.

Constructor Detail

ShutdownHookManager

public ShutdownHookManager()
Method Detail

addShutdownAction

public static void addShutdownAction(int shutdownAction)
Register an action to be performed on shutdown of the application. The calling class can send in any value in the parameter, but only those actions defined in this class will be performed.

Parameters:
shutdownAction - The action identifier or a union of those for multiple actions.

shutDown

protected static void shutDown()
Method called when the runtime is going down, all actions registered will be checked and performed.



Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.