KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > resource > monitor > ConnectorServiceMonitoringLevelListener


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 package com.sun.enterprise.resource.monitor;
24
25 //removed unnecessary imports
26
import java.util.logging.Logger JavaDoc;
27
28 import javax.management.j2ee.statistics.Stats JavaDoc;
29
30 import com.sun.enterprise.admin.monitor.registry.MonitoredObjectType;
31 import com.sun.enterprise.admin.monitor.registry.MonitoringLevel;
32 import com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener;
33 import com.sun.enterprise.connectors.work.monitor.ConnectorWorkMonitoringLevelListener;
34 import com.sun.logging.LogDomains;
35
36
37 /**
38  * Provides an implementation of the MonitoringLevelListener interface to
39  * receive callbacks from admin regarding change in the connector-service
40  * monitoring level.
41  *
42  * Though there are 3 monitoring levels defined by JSR77, we support
43  * only 2 levels - OFF and ON (HIGH/LOW). So essentially, HIGH and LOW
44  * for us is only ON
45  *
46  * @author Sivakumar Thyagarajan
47  * @since sjsas pe/se/ee 8.1
48  */

49
50 public class ConnectorServiceMonitoringLevelListener
51                             implements MonitoringLevelListener {
52
53     private ConnectorPoolMonitoringLevelListener ccpPoolMonitoringLevelListener_;
54     private ConnectorWorkMonitoringLevelListener cwMonitoringLevelListener_;
55     
56     private static Logger JavaDoc _logger = LogDomains.getLogger(
57         LogDomains.RSR_LOGGER );
58     
59     public ConnectorServiceMonitoringLevelListener(){
60         ccpPoolMonitoringLevelListener_ = new ConnectorPoolMonitoringLevelListener();
61         cwMonitoringLevelListener_ = new ConnectorWorkMonitoringLevelListener();
62     }
63
64
65     /**
66      * @see com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener#setLevel(com.sun.enterprise.admin.monitor.registry.MonitoringLevel)
67      * @deprecated
68      */

69     //remove after admin removes it
70
public void setLevel( MonitoringLevel level ) {}
71     
72     /**
73      * This is the callback invoked by the MonitoringRegistry
74      * on change in monitoring level
75      *
76      * @param from - the past level
77      * @param to - the new level
78      * @param handback - the Stats object this listener was registered for
79      * @deprecated
80      */

81     public void changeLevel( MonitoringLevel from, MonitoringLevel to,
82         Stats JavaDoc handback ) {}
83
84     public void changeLevel(MonitoringLevel from, MonitoringLevel to,
85             MonitoredObjectType type) {
86         /*
87          * For backward compatability reasons: When connector connection pool or
88          * the JMS-Service module monitoring level is updated, the connector
89          * service's module monitoring level listener is updated and vice-versa.
90          *
91          * Change levels in connector connection pools and
92          * connector work management level listeners as well.
93          */

94         ccpPoolMonitoringLevelListener_.changeLevel(from, to, type);
95         cwMonitoringLevelListener_.changeLevel(from, to, type);
96     }
97 }
Popular Tags