jmri.implementation
Class DefaultShutDownManager

java.lang.Object
  extended by jmri.implementation.DefaultShutDownManager
All Implemented Interfaces:
ShutDownManager

public class DefaultShutDownManager
extends Object
implements 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, 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.

To avoid being unable to quit the program, which annoys people, an exception in a ShutDownTask is treated as permission to continue after logging.

Author:
Bob Jacobsen Copyright (C) 2008

Constructor Summary
DefaultShutDownManager()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultShutDownManager

public DefaultShutDownManager()
Method Detail

register

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

Specified by:
register in interface ShutDownManager

deregister

public void deregister(ShutDownTask s)
Deregister a task object.

Specified by:
deregister in interface ShutDownManager
Throws:
IllegalArgumentException - if task object not currently registered

shutdown

public 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.

Specified by:
shutdown in interface ShutDownManager


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