00001 /** 00002 * C-JDBC: Clustered JDBC. 00003 * Copyright (C) 2005 Emic Networks. 00004 * Contact: c-jdbc@objectweb.org 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by the 00008 * Free Software Foundation; either version 2.1 of the License, or any later 00009 * version. 00010 * 00011 * This library is distributed in the hope that it will be useful, but WITHOUT 00012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00014 * for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this library; if not, write to the Free Software Foundation, 00018 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00019 * 00020 * Initial developer(s): Emmanuel Cecchet. 00021 * Contributor(s): ______________________. 00022 */ 00023 00024 package org.objectweb.cjdbc.controller.core.shutdown; 00025 00026 import org.objectweb.cjdbc.common.exceptions.ShutdownException; 00027 import org.objectweb.cjdbc.common.util.Constants; 00028 import org.objectweb.cjdbc.controller.core.Controller; 00029 00030 /** 00031 * This thread waits for all clients to terminate their connections before 00032 * shutting down the controller. 00033 * 00034 * @author <a href="mailto:emmanuel.cecchet@emicnetworks.com">Emmanuel Cecchet 00035 * </a> 00036 * @version 1.0 00037 */ 00038 public class ControllerSafeShutdownThread extends ControllerShutdownThread 00039 { 00040 00041 /** 00042 * Creates a new <code>ControllerWaitShutdownThread</code> object 00043 * 00044 * @param controller the controller to shutdown 00045 */ 00046 public ControllerSafeShutdownThread(Controller controller) 00047 { 00048 super(controller, Constants.SHUTDOWN_WAIT); 00049 } 00050 00051 /** 00052 * @see org.objectweb.cjdbc.controller.core.shutdown.ShutdownThread#shutdown() 00053 */ 00054 public void shutdown() throws ShutdownException 00055 { 00056 logger.info("Starting controller shutdown"); 00057 shutdownDatabases(); 00058 generateReportIfNeeded(); 00059 shutdownJmxAgent(); 00060 shutdownServerConnectionThread(0); 00061 logger.info("Controller shutdown completed"); 00062 } 00063 00064 }