KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > server > Shutdown


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.server;
25
26 import java.util.logging.Level JavaDoc;
27 import java.util.logging.Logger JavaDoc;
28 import com.sun.logging.LogDomains;
29
30 import com.sun.enterprise.admin.event.AdminEventListener;
31 import com.sun.enterprise.admin.event.ShutdownEventListener;
32 import com.sun.enterprise.admin.event.ShutdownEvent;
33 import com.sun.enterprise.admin.event.AdminEventListenerException;
34 import com.sun.enterprise.server.PEMain;
35 import com.sun.enterprise.server.J2EEServer;
36 import com.sun.appserv.server.ServerLifecycleException;
37
38 //i18n import
39
import com.sun.enterprise.util.i18n.StringManager;
40
41 import com.sun.enterprise.security.audit.AuditManager;
42 import com.sun.enterprise.security.audit.AuditManagerFactory;
43
44 /**
45  * Listener to handle shutdown event.
46  */

47
48 public class Shutdown implements ShutdownEventListener {
49
50     /** logger for this manager */
51     static Logger JavaDoc _logger = LogDomains.getLogger(LogDomains.CORE_LOGGER);
52
53     /**
54      * Start shutdown on this instance.
55      * @throws AdminEventListenerException when the listener is unable to
56      * process the event.
57      */

58     public void startShutdown(ShutdownEvent event)
59             throws AdminEventListenerException {
60     
61     try {
62         PEMain.getApplicationServer().onShutdown();
63         PEMain.getApplicationServer().onTermination();
64         
65     } catch (ServerLifecycleException e) {
66         _logger.log(Level.SEVERE,"shutdown.error",e.getMessage());
67     }
68
69     AuditManager auditManager =
70         AuditManagerFactory.getAuditManagerInstance();
71
72     if (auditManager.isAuditOn()){
73         auditManager.serverShutdown();
74     }
75
76     J2EEServer.shutdown();
77     _logger.log(Level.FINE, "finished calling J2EEServer.clientShutdown()..");
78
79     }
80
81
82
83 }
84
Popular Tags