org.mycore.common.events
Class MCRShutdownHandler

java.lang.Object
  extended by org.mycore.common.events.MCRShutdownHandler

public class MCRShutdownHandler
extends Object

is a wrapper for shutdown hooks. When used inside a web application this shutdown hook is bound to the ServletContext. If not this hook is bound to the Java Runtime. Every Closeable that is added via addCloseable() will be closed at shutdown time. Do not forget to remove any closeable via removeCloseable() to remove any instances. For registering this hook for a web application see MCRServletContextListener

Since:
1.3
Author:
Thomas Scheffler (yagee)
See Also:
MCRShutdownThread, MCRServletContextListener

Nested Class Summary
static interface MCRShutdownHandler.Closeable
          Object is cleanly closeable via close()-call.
 
Field Summary
(package private)  boolean isWebAppRunning
           
 
Method Summary
 void addCloseable(MCRShutdownHandler.Closeable c)
           
static MCRShutdownHandler getInstance()
           
 void removeCloseable(MCRShutdownHandler.Closeable c)
           
(package private)  void shutDown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isWebAppRunning

boolean isWebAppRunning
Method Detail

getInstance

public static MCRShutdownHandler getInstance()

addCloseable

public void addCloseable(MCRShutdownHandler.Closeable c)

removeCloseable

public void removeCloseable(MCRShutdownHandler.Closeable c)

shutDown

void shutDown()