jmri
Interface ShutDownManager

All Known Implementing Classes:
DefaultShutDownManager

public interface ShutDownManager

Manage tasks to be completed when the program shuts down normally. Specifically, allows other object to register and deregister ShutDownTask objects, which are invoked in an orderly way when the program is is commanded to terminate.

Operations:

  1. Execute each ShutDownTask in order reverse order of creation, allowing it to abort the shutdown if needed.
  2. If not aborted, terminate the program.

There can only be one instance of this operating, and it is generally obtained via the instance manager.

Items are executed in reverse order to attempt to unwind the creation process. Tasks should not count on this, however, as shutdown can be aborted before a particular task is reached.

Tasks should leave the system in a state that can continue, in case a later task aborts the shutdown.

An instance of this is normally obtained from the instance manager, but using routines should not assume that one is always present; they should check for a null manager and skip operations if needed.

Author:
Bob Jacobsen Copyright (C) 2008

Method Summary
 void deregister(ShutDownTask s)
          Deregister a task object.
 void register(ShutDownTask s)
          Register a task object for later execution
 void shutdown()
          Run the shutdown tasks, and then terminate the program if not aborted.
 

Method Detail

register

void register(ShutDownTask s)
Register a task object for later execution


deregister

void deregister(ShutDownTask s)
Deregister a task object.

Throws:
IllegalArgumentException - if task object not currently registered

shutdown

void shutdown()
Run the shutdown tasks, and then terminate the program if not aborted. Does not return under normal circumstances. Does return if the shutdown was aborted by the user, in which case the program should continue to operate.



Copyright © 1997 - 2008 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: SourceForge_Logo