Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread Class Reference

Inheritance diagram for org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread:

Inheritance graph
[legend]
Collaboration diagram for org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ControllerShutdownThread (Controller controller, int level)

Protected Member Functions

void shutdownJmxAgent ()
void shutdownDatabases ()
void shutdownServerConnectionThread (int joinTimeoutInMillis) throws ShutdownException
void generateReportIfNeeded ()

Protected Attributes

Controller controller

Detailed Description

Abstract class for all implementations of controller shutdown strategies.

Author:
Nicolas Modrzyk

Emmanuel Cecchet

Version:
1.2

Definition at line 46 of file ControllerShutdownThread.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread.ControllerShutdownThread Controller  controller,
int  level
 

Prepare the thread for shutting down.

Parameters:
controller the controller to shutdown
level Constants.SHUTDOWN_WAIT, Constants.SHUTDOWN_SAFE or Constants.SHUTDOWN_FORCE

Definition at line 57 of file ControllerShutdownThread.java.

00058   {
00059     super(level);
00060     this.controller = controller;
00061   }


Member Function Documentation

void org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread.generateReportIfNeeded  )  [protected]
 

Generate a controller report if it has been enabled in the config file.

Definition at line 143 of file ControllerShutdownThread.java.

References org.objectweb.cjdbc.controller.core.ReportManager.generate(), org.objectweb.cjdbc.controller.core.Controller.getReport(), org.objectweb.cjdbc.controller.core.ReportManager.getReportLocation(), org.objectweb.cjdbc.common.log.Trace.info(), org.objectweb.cjdbc.controller.core.ReportManager.isGenerateOnShutdown(), and org.objectweb.cjdbc.controller.core.ReportManager.startReport().

Referenced by org.objectweb.cjdbc.controller.core.shutdown.ControllerWaitShutdownThread.shutdown(), org.objectweb.cjdbc.controller.core.shutdown.ControllerSafeShutdownThread.shutdown(), and org.objectweb.cjdbc.controller.core.shutdown.ControllerForceShutdownThread.shutdown().

00144   {
00145     ReportManager report = controller.getReport();
00146     if (report != null && report.isGenerateOnShutdown())
00147     {
00148       report.startReport();
00149       report.generate();
00150       logger.info(Translate.get("fatal.report.generated", report
00151           .getReportLocation()
00152           + File.separator + ControllerConstants.REPORT_FILE));
00153     }
00154   }

void org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread.shutdownDatabases  )  [protected]
 

Shutdown all databases of this controller using the current shutdown level.

Definition at line 85 of file ControllerShutdownThread.java.

References org.objectweb.cjdbc.common.log.Trace.error(), org.objectweb.cjdbc.controller.core.Controller.getVirtualDatabases(), and org.objectweb.cjdbc.common.log.Trace.info().

Referenced by org.objectweb.cjdbc.controller.core.shutdown.ControllerWaitShutdownThread.shutdown(), org.objectweb.cjdbc.controller.core.shutdown.ControllerSafeShutdownThread.shutdown(), and org.objectweb.cjdbc.controller.core.shutdown.ControllerForceShutdownThread.shutdown().

00086   {
00087     logger.info("Shutting down databases");
00088     try
00089     {
00090       //Shutdown each virtual database with proper level
00091       ArrayList listvb = controller.getVirtualDatabases();
00092       int nbvb = listvb.size();
00093       for (int i = 0; i < nbvb; i++)
00094       {
00095         logger.info("Shutting down database:"
00096             + ((VirtualDatabase) listvb.get(i)).getVirtualDatabaseName()
00097             + " with level:" + this.shutdownLevel);
00098         ((VirtualDatabase) listvb.get(i)).shutdown(this.shutdownLevel);
00099         logger.info("Database:"
00100             + ((VirtualDatabase) listvb.get(i)).getVirtualDatabaseName()
00101             + " is shutdown");
00102       }
00103     }
00104     catch (Exception e)
00105     {
00106       logger.error(Translate.get("controller.shutdown.database.error", e));
00107     }
00108   }

void org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread.shutdownJmxAgent  )  [protected]
 

Shutdown the JMX Agent.

Definition at line 66 of file ControllerShutdownThread.java.

References org.objectweb.cjdbc.common.log.Trace.error(), org.objectweb.cjdbc.controller.core.Controller.getJmxEnable(), and org.objectweb.cjdbc.common.log.Trace.info().

Referenced by org.objectweb.cjdbc.controller.core.shutdown.ControllerWaitShutdownThread.shutdown(), org.objectweb.cjdbc.controller.core.shutdown.ControllerSafeShutdownThread.shutdown(), and org.objectweb.cjdbc.controller.core.shutdown.ControllerForceShutdownThread.shutdown().

00067   {
00068     logger.info("Shutting down Jmx Agent");
00069     try
00070     {
00071       if (controller.getJmxEnable())
00072         MBeanServerManager.setJmxEnabled(false);
00073     }
00074     catch (Exception jme)
00075     {
00076       logger.error(Translate.get("controller.shutdown.jmx.error", jme
00077           .getMessage()), jme);
00078       //throw new ShutdownException(jme);
00079     }
00080   }

void org.objectweb.cjdbc.controller.core.shutdown.ControllerShutdownThread.shutdownServerConnectionThread int  joinTimeoutInMillis  )  throws ShutdownException [protected]
 

Shutdown the ControllerServerThread and its attached connection to reject new incoming connections.

Parameters:
joinTimeoutInMillis timeout in milliseconds to wait for controller server thread termination. A timeout of 0 means wait forever.
Exceptions:
ShutdownException if an error occurs

Definition at line 118 of file ControllerShutdownThread.java.

References org.objectweb.cjdbc.common.log.Trace.debug(), org.objectweb.cjdbc.controller.core.Controller.getConnectionThread(), org.objectweb.cjdbc.common.log.Trace.info(), org.objectweb.cjdbc.common.log.Trace.isDebugEnabled(), org.objectweb.cjdbc.controller.core.ControllerServerThread.isShuttingDown, and org.objectweb.cjdbc.controller.core.ControllerServerThread.shutdown().

Referenced by org.objectweb.cjdbc.controller.core.shutdown.ControllerWaitShutdownThread.shutdown(), org.objectweb.cjdbc.controller.core.shutdown.ControllerSafeShutdownThread.shutdown(), and org.objectweb.cjdbc.controller.core.shutdown.ControllerForceShutdownThread.shutdown().

00120   {
00121     if (logger.isDebugEnabled())
00122       logger.debug("Shutting down ControllerServerThread");
00123     try
00124     {
00125       // Shutdown Server Connections Thread
00126       ControllerServerThread thread = controller.getConnectionThread();
00127       if (thread != null && !thread.isShuttingDown())
00128       {
00129         thread.shutdown();
00130         logger.info("Waiting for controller thread termination.");
00131         thread.join(joinTimeoutInMillis);
00132       }
00133     }
00134     catch (Exception e)
00135     {
00136       throw new ShutdownException(e);
00137     }
00138   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:03:47 2005 for C-JDBC by  doxygen 1.3.9.1