KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > base > stats > MonitoringRegistryMediator


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.ejb.base.stats;
25
26 import javax.management.j2ee.statistics.Stats JavaDoc;
27
28 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistry;
29 import com.sun.enterprise.admin.monitor.registry.MonitoringLevelListener;
30 import com.sun.enterprise.admin.monitor.registry.MonitoringLevel;
31 import com.sun.enterprise.admin.monitor.registry.MonitoredObjectType;
32 import com.sun.enterprise.admin.monitor.registry.MonitoringRegistrationException;
33
34 import com.sun.enterprise.config.ConfigContext;
35 import com.sun.enterprise.config.ConfigBean;
36 import com.sun.enterprise.config.serverbeans.ServerBeansFactory;
37 import com.sun.enterprise.config.serverbeans.Config;
38 import com.sun.enterprise.server.ApplicationServer;
39 import com.sun.enterprise.server.ServerContext;
40 import com.sun.enterprise.config.ConfigException;
41 import com.sun.enterprise.config.serverbeans.TransactionService;
42
43 import com.sun.ejb.spi.stats.EJBCacheStatsProvider;
44 import com.sun.ejb.spi.stats.EJBMethodStatsProvider;
45 import com.sun.ejb.spi.stats.EJBPoolStatsProvider;
46 import com.sun.ejb.spi.stats.EJBStatsProvider;
47 import com.sun.ejb.spi.stats.StatelessSessionBeanStatsProvider;
48 import com.sun.ejb.spi.stats.StatefulSessionBeanStatsProvider;
49 import com.sun.ejb.spi.stats.EntityBeanStatsProvider;
50 import com.sun.ejb.spi.stats.MessageDrivenBeanStatsProvider;
51 import com.sun.ejb.spi.stats.EJBTimedObjectStatsProvider;
52 import com.sun.ejb.spi.stats.EJBMethodStatsManager;
53 import com.sun.ejb.spi.stats.MonitorableSFSBStoreManager;
54
55 import java.lang.reflect.Method JavaDoc;
56
57 import java.util.logging.*;
58 import com.sun.enterprise.log.Log;
59 import com.sun.logging.*;
60
61 /**
62  * A class that acts as an Mediator between admin.registry.* objects
63  * and EJBContainers. There is one instance of MonitoringRegistryMediator
64  * per EJBContainer. Containers interact only with this object
65  * and are completely unaware of any the MonitoringRegistry classes
66  *
67  * @author Mahesh Kannan
68  */

69
70 public class MonitoringRegistryMediator
71     implements MonitoringLevelListener
72 {
73     private static final int ENTITY_CONTAINER_TYPE = 0;
74     private static final int STATELESS_CONTAINER_TYPE = 1;
75     private static final int STATEFUL_CONTAINER_TYPE = 2;
76     private static final int MESSAGE_CONTAINER_TYPE = 3;
77
78     private static Logger _logger =
79         LogDomains.getLogger(LogDomains.EJB_LOGGER);
80
81     private String JavaDoc appName;
82     private String JavaDoc modName;
83     private String JavaDoc ejbName;
84     
85     private int containerType;
86     private MonitoringLevel currentMonitoringLevel;
87     private MonitoringRegistry registry;
88
89     private EJBStatsProvider ejbStatsProvider;
90     private EJBCacheStatsProvider ejbCacheStatsProvider;
91     private EJBPoolStatsProvider ejbPoolStatsProvider;
92     private MonitorableSFSBStoreManager sfsbStoreStatsProvider;
93     private EJBTimedObjectStatsProvider ejbTimedObjectStatsProvider;
94
95     private EJBStatsImpl ejbStatsImpl;
96     private EJBCacheStatsImpl ejbCacheStatsImpl;
97     private EJBPoolStatsImpl ejbPoolStatsImpl;
98     private EJBTimedObjectStatsImpl ejbTimedObjectStatsImpl;
99     private EJBMethodStatsManagerImpl ejbMethodStatsManager;
100
101     private StatefulSessionStoreMonitor sfsbStoreMonitor;
102     private boolean isHAStore;
103
104     private Level TRACE_LEVEL = Level.INFO;
105     private Object JavaDoc[] logParams = null;
106
107     public MonitoringRegistryMediator(String JavaDoc ejbName, String JavaDoc modName,
108         String JavaDoc appName)
109     {
110     this.appName = appName;
111     this.modName = modName;
112     this.ejbName = ejbName;
113     
114     logParams = new Object JavaDoc[] {ejbName, modName, appName};
115
116     this.registry = ApplicationServer.getServerContext().
117         getMonitoringRegistry();
118
119     this.ejbMethodStatsManager = new EJBMethodStatsManagerImpl(
120         registry, ejbName, modName, appName);
121     }
122
123     public void registerProvider(StatelessSessionBeanStatsProvider provider) {
124     this.ejbStatsProvider = provider;
125     this.containerType = STATELESS_CONTAINER_TYPE;
126     registry.registerMonitoringLevelListener(this,
127         MonitoredObjectType.EJB);
128     this.currentMonitoringLevel = getCurrentMonitoringLevel();
129     if (! isMonitoringOff()) {
130         registerContainerStats();
131     }
132     }
133
134     public void registerProvider(StatefulSessionBeanStatsProvider provider) {
135     this.ejbStatsProvider = provider;
136     this.containerType = STATEFUL_CONTAINER_TYPE;
137     registry.registerMonitoringLevelListener(this,
138         MonitoredObjectType.EJB);
139     this.currentMonitoringLevel = getCurrentMonitoringLevel();
140     if (! isMonitoringOff()) {
141         registerContainerStats();
142     }
143     }
144
145     public void registerProvider(EntityBeanStatsProvider provider) {
146     this.ejbStatsProvider = provider;
147     this.containerType = ENTITY_CONTAINER_TYPE;
148     registry.registerMonitoringLevelListener(this,
149         MonitoredObjectType.EJB);
150     this.currentMonitoringLevel = getCurrentMonitoringLevel();
151     if (! isMonitoringOff()) {
152         registerContainerStats();
153     }
154     }
155
156     public void registerProvider(MessageDrivenBeanStatsProvider provider) {
157     this.ejbStatsProvider = provider;
158     this.containerType = MESSAGE_CONTAINER_TYPE;
159     registry.registerMonitoringLevelListener(this,
160         MonitoredObjectType.EJB);
161     this.currentMonitoringLevel = getCurrentMonitoringLevel();
162     if (! isMonitoringOff()) {
163         registerContainerStats();
164     }
165     }
166
167     public void registerProvider(EJBCacheStatsProvider provider) {
168     this.ejbCacheStatsProvider = provider;
169     if (! isMonitoringOff()) {
170         registerCacheStats();
171     }
172     }
173
174     public void registerProvider(EJBPoolStatsProvider provider) {
175     this.ejbPoolStatsProvider = provider;
176     if (! isMonitoringOff()) {
177         registerPoolStats();
178     }
179     }
180
181     public StatefulSessionStoreMonitor registerProvider(
182         MonitorableSFSBStoreManager provider, boolean isHAStore)
183     {
184     this.sfsbStoreStatsProvider = provider;
185     this.isHAStore = isHAStore;
186     if (isHAStore) {
187         this.sfsbStoreMonitor = new HAStatefulSessionStoreMonitor();
188     } else {
189         this.sfsbStoreMonitor = new StatefulSessionStoreMonitor();
190     }
191     if (! isMonitoringOff()) {
192         registerSFSBStoreStats();
193     }
194
195     return sfsbStoreMonitor;
196     }
197
198     public EJBMethodStatsManager getEJBMethodStatsManager() {
199     return this.ejbMethodStatsManager;
200     }
201
202     public void registerEJBMethods(Method JavaDoc[] methods) {
203     this.ejbMethodStatsManager.registerMethods(methods);
204     if (isMonitoringHigh()) {
205         this.ejbMethodStatsManager.setMethodMonitorOn(true);
206     }
207     }
208
209     public void registerProvider(EJBTimedObjectStatsProvider provider) {
210     this.ejbTimedObjectStatsProvider = provider;
211     if (! isMonitoringOff()) {
212         registerTimedObjectStats();
213     }
214     }
215
216     //Methods for MonitoringLevelListener interface
217
public void setLevel(MonitoringLevel level) {}
218
219     public void changeLevel(MonitoringLevel from, MonitoringLevel to,
220         Stats JavaDoc type)
221     {
222     //No op. Deprecated
223
}
224     
225     public void changeLevel(MonitoringLevel fromLevel,
226         MonitoringLevel toLevel, MonitoredObjectType type)
227     {
228     if (type == MonitoredObjectType.EJB) {
229         synchronized (this) {
230         if (_logger.isLoggable(Level.FINE)) {
231             _logger.log(Level.FINE, "[MonitoringMediator] Level "
232             + "changed from: "
233             + monitoringLevelAsString(currentMonitoringLevel)
234             + " to: "
235             + monitoringLevelAsString(toLevel));
236         }
237         }
238         this.currentMonitoringLevel = toLevel;
239
240         if (toLevel == MonitoringLevel.OFF) {
241         deregisterPoolStats();
242         deregisterCacheStats();
243         ejbMethodStatsManager.setMethodMonitorOn(false);
244         deregisterSFSBStoreStats();
245         deregisterContainerStats();
246         deregisterTimedObjectStats();
247         } else {
248         registerContainerStats();
249         registerPoolStats();
250         registerCacheStats();
251         registerSFSBStoreStats();
252         ejbMethodStatsManager.setMethodMonitorOn(
253             toLevel == MonitoringLevel.HIGH);
254         registerTimedObjectStats();
255         }
256     }
257     }
258
259     public void undeploy() {
260     try {
261         deregisterPoolStats();
262         deregisterCacheStats();
263         ejbMethodStatsManager.undeploy();
264         deregisterContainerStats();
265         deregisterSFSBStoreStats();
266         deregisterTimedObjectStats();
267     } finally {
268         ejbStatsProvider = null;
269         ejbCacheStatsProvider = null;
270         ejbPoolStatsProvider = null;
271         ejbMethodStatsManager = null;
272         sfsbStoreStatsProvider = null;
273         sfsbStoreMonitor = null;
274         ejbTimedObjectStatsProvider = null;
275
276         registry.unregisterMonitoringLevelListener(this);
277     }
278     }
279
280     /************** Internal methods ********************/
281
282     private void registerContainerStats() {
283     if ((ejbStatsProvider == null) || (this.ejbStatsImpl != null)) {
284         return;
285     }
286
287     try {
288         switch (containerType) {
289         case STATELESS_CONTAINER_TYPE:
290             StatelessSessionBeanStatsImpl slsbImpl =
291             new StatelessSessionBeanStatsImpl(
292             (StatelessSessionBeanStatsProvider) ejbStatsProvider);
293             registry.registerStatelessSessionBeanStats(slsbImpl,
294             ejbName, modName, appName, null);
295             this.ejbStatsImpl = slsbImpl;
296             break;
297         case STATEFUL_CONTAINER_TYPE:
298             StatefulSessionBeanStatsImpl sfsbImpl =
299             new StatefulSessionBeanStatsImpl(
300             (StatefulSessionBeanStatsProvider) ejbStatsProvider);
301             registry.registerStatefulSessionBeanStats(sfsbImpl,
302                 ejbName, modName, appName, null);
303             this.ejbStatsImpl = sfsbImpl;
304             break;
305         case ENTITY_CONTAINER_TYPE:
306             EntityBeanStatsImpl entityImpl =
307             new EntityBeanStatsImpl(
308             (EntityBeanStatsProvider) ejbStatsProvider);
309             registry.registerEntityBeanStats(entityImpl,
310                 ejbName, modName, appName, null);
311             this.ejbStatsImpl = entityImpl;
312             break;
313         case MESSAGE_CONTAINER_TYPE:
314             MessageDrivenBeanStatsImpl mdbImpl =
315             new MessageDrivenBeanStatsImpl(
316             (MessageDrivenBeanStatsProvider) ejbStatsProvider);
317             registry.registerMessageDrivenBeanStats(mdbImpl,
318                 ejbName, modName, appName, null);
319             this.ejbStatsImpl = mdbImpl;
320             break;
321         }
322         if (_logger.isLoggable(Level.FINE)) {
323         _logger.log(Level.FINE, "[MonitoringMediator] registered "
324             + " container stats for " + appName
325             + "; " + modName + "; " + ejbName);
326         }
327     } catch (MonitoringRegistrationException monRegEx) {
328         ejbStatsImpl = null;
329         _logger.log(Level.WARNING,
330         "base.stats.mediator.ejb.register.monreg.error", logParams);
331         _logger.log(Level.FINE, "", monRegEx);
332     } catch (Exception JavaDoc ex) {
333         ejbStatsImpl = null;
334         _logger.log(Level.WARNING,
335         "base.stats.mediator.ejb.register.error", logParams);
336         _logger.log(Level.FINE, "", ex);
337     }
338     }
339
340     private void deregisterContainerStats() {
341     try {
342         if (ejbStatsImpl != null) {
343         switch (containerType) {
344             case STATELESS_CONTAINER_TYPE:
345             registry.unregisterStatelessSessionBeanStats(
346                 ejbName, modName, appName);
347             break;
348             case STATEFUL_CONTAINER_TYPE:
349             registry.unregisterStatefulSessionBeanStats(
350                 ejbName, modName, appName);
351             break;
352             case ENTITY_CONTAINER_TYPE:
353             registry.unregisterEntityBeanStats(
354                 ejbName, modName, appName);
355             break;
356             case MESSAGE_CONTAINER_TYPE:
357             registry.unregisterMessageDrivenBeanStats(
358                 ejbName, modName, appName);
359             break;
360         }
361         if (_logger.isLoggable(Level.FINE)) {
362             _logger.log(Level.FINE, "[MonitoringMediator] unregistered "
363                 + " container stats for " + appName
364                 + "; " + modName + "; " + ejbName);
365         }
366         }
367     } catch (MonitoringRegistrationException monRegEx) {
368         _logger.log(Level.WARNING,
369         "base.stats.mediator.ejb.unregister.monreg.error", logParams);
370         _logger.log(Level.FINE, "", monRegEx);
371     } catch (Exception JavaDoc ex) {
372         _logger.log(Level.WARNING,
373         "base.stats.mediator.ejb.unregister.error", logParams);
374         _logger.log(Level.FINE, "", ex);
375     } finally {
376         ejbStatsImpl = null;
377     }
378     }
379
380     private void registerPoolStats() {
381     if ((ejbPoolStatsProvider != null) && (ejbPoolStatsImpl == null)) {
382         try {
383         ejbPoolStatsImpl = new EJBPoolStatsImpl(ejbPoolStatsProvider);
384         registry.registerEJBPoolStats(ejbPoolStatsImpl,
385             ejbName, modName, appName, null);
386         if (_logger.isLoggable(Level.FINE)) {
387             _logger.log(Level.FINE, "[MonitoringMediator] registered "
388                 + " pool stats for " + appName
389                 + "; " + modName + "; " + ejbName);
390         }
391         } catch (MonitoringRegistrationException monRegEx) {
392         ejbPoolStatsImpl = null;
393         _logger.log(Level.WARNING,
394             "base.stats.mediator.pool.register.monreg.error", logParams);
395         _logger.log(Level.FINE, "", monRegEx);
396         } catch (Exception JavaDoc ex) {
397         ejbPoolStatsImpl = null;
398         _logger.log(Level.WARNING,
399             "base.stats.mediator.pool.register.error", logParams);
400         _logger.log(Level.FINE, "", ex);
401         }
402     }
403     }
404
405     private void registerCacheStats() {
406     if ((ejbCacheStatsProvider != null) && (ejbCacheStatsImpl == null)) {
407         try {
408         ejbCacheStatsImpl = new EJBCacheStatsImpl(ejbCacheStatsProvider);
409         registry.registerEJBCacheStats(ejbCacheStatsImpl,
410             ejbName, modName, appName, null);
411         if (_logger.isLoggable(Level.FINE)) {
412             _logger.log(Level.FINE, "[MonitoringMediator] registered "
413                 + " cache stats for " + appName
414                 + "; " + modName + "; " + ejbName);
415         }
416         } catch (MonitoringRegistrationException monRegEx) {
417         ejbCacheStatsImpl = null;
418         _logger.log(Level.WARNING,
419             "base.stats.mediator.cache.register.monreg.error", logParams);
420         _logger.log(Level.FINE, "", monRegEx);
421         } catch (Exception JavaDoc ex) {
422         ejbCacheStatsImpl = null;
423         _logger.log(Level.WARNING,
424             "base.stats.mediator.cache.register.error", logParams);
425         _logger.log(Level.FINE, "", ex);
426         }
427     }
428     }
429
430     private void registerSFSBStoreStats() {
431     if (sfsbStoreMonitor != null) {
432         StatefulSessionStoreStatsImpl statsImpl = null;
433         statsImpl = (isHAStore)
434         ? new HAStatefulSessionStoreStatsImpl(sfsbStoreStatsProvider)
435         : new StatefulSessionStoreStatsImpl(sfsbStoreStatsProvider);
436         sfsbStoreMonitor.setDelegate(statsImpl);
437         //FIXME: registry.registerStatefulSessionStoreStats(statsImpl);
438
sfsbStoreStatsProvider.monitoringLevelChanged(true);
439     }
440     }
441
442     private void registerTimedObjectStats() {
443     if (ejbTimedObjectStatsProvider != null) {
444             ejbTimedObjectStatsProvider.monitoringLevelChanged(true);
445             if (ejbTimedObjectStatsImpl == null) {
446             try {
447             ejbTimedObjectStatsImpl =
448                         new EJBTimedObjectStatsImpl(
449                             ejbTimedObjectStatsProvider );
450             registry.registerTimerStats(ejbTimedObjectStatsImpl,
451                 ejbName, modName, appName, null);
452             if (_logger.isLoggable(Level.FINE)) {
453                 _logger.log(Level.FINE, "[MonitoringMediator] registered "
454                     + " timed Object stats for " + appName
455                     + "; " + modName + "; " + ejbName);
456             }
457             } catch (MonitoringRegistrationException monRegEx) {
458             ejbTimedObjectStatsImpl = null;
459             _logger.log(Level.WARNING,
460                 "base.stats.mediator.timedObject.register.monreg.error", logParams);
461             _logger.log(Level.FINE, "", monRegEx);
462             } catch (Exception JavaDoc ex) {
463             ejbTimedObjectStatsImpl = null;
464             _logger.log(Level.WARNING,
465                 "base.stats.mediator.timedObject.register.error", logParams);
466             _logger.log(Level.FINE, "", ex);
467             }
468         }
469         }
470     }
471
472     private void deregisterPoolStats() {
473     if ((ejbPoolStatsProvider != null) && (ejbPoolStatsImpl != null)) {
474         try {
475         registry.unregisterEJBPoolStats(ejbName, modName, appName);
476         if (_logger.isLoggable(Level.FINE)) {
477             _logger.log(Level.FINE, "[MonitoringMediator] unregistered "
478                 + " pool stats for " + appName
479                 + "; " + modName + "; " + ejbName);
480         }
481         } catch (MonitoringRegistrationException monRegEx) {
482         _logger.log(Level.WARNING,
483             "base.stats.mediator.pool.unregister.monreg.error", logParams);
484         _logger.log(Level.FINE, "", monRegEx);
485         } catch (Exception JavaDoc ex) {
486         _logger.log(Level.WARNING,
487             "base.stats.mediator.pool.unregister.error", logParams);
488         _logger.log(Level.FINE, "", ex);
489         } finally {
490         ejbPoolStatsImpl = null;
491         }
492     }
493     }
494
495     private void deregisterCacheStats() {
496     if ((ejbCacheStatsProvider != null) && (ejbCacheStatsImpl != null)) {
497         try {
498         registry.unregisterEJBCacheStats(ejbName, modName, appName);
499         if (_logger.isLoggable(Level.FINE)) {
500             _logger.log(Level.FINE, "[MonitoringMediator] unregistered "
501                 + " cache stats for " + appName
502                 + "; " + modName + "; " + ejbName);
503         }
504         } catch (MonitoringRegistrationException monRegEx) {
505         _logger.log(Level.WARNING,
506             "base.stats.mediator.cache.unregister.monreg.error", logParams);
507         _logger.log(Level.FINE, "", monRegEx);
508         } catch (Exception JavaDoc ex) {
509         _logger.log(Level.WARNING,
510             "base.stats.mediator.cache.unregister.error", logParams);
511         _logger.log(Level.FINE, "", ex);
512         } finally {
513         ejbCacheStatsImpl = null;
514         }
515     }
516     }
517
518     private void deregisterSFSBStoreStats() {
519     //FIXME: registry.unregisterStatefulSessionStoreStats(ejbName, modName, appName);
520
if (sfsbStoreMonitor != null) {
521         sfsbStoreStatsProvider.monitoringLevelChanged(false);
522         sfsbStoreMonitor.setDelegate(null);
523     }
524     }
525
526     private void deregisterTimedObjectStats() {
527     if ((ejbTimedObjectStatsProvider != null) && (ejbTimedObjectStatsImpl != null)) {
528         try {
529                 ejbTimedObjectStatsProvider.monitoringLevelChanged(false);
530         registry.unregisterTimerStats(ejbName, modName, appName);
531         if (_logger.isLoggable(Level.FINE)) {
532             _logger.log(Level.FINE, "[MonitoringMediator] unregistered "
533                 + " timed Object stats for " + appName
534                 + "; " + modName + "; " + ejbName);
535         }
536         } catch (MonitoringRegistrationException monRegEx) {
537         _logger.log(Level.WARNING,
538             "base.stats.mediator.timedObject.unregister.monreg.error", logParams);
539         _logger.log(Level.FINE, "", monRegEx);
540         } catch (Exception JavaDoc ex) {
541         _logger.log(Level.WARNING,
542             "base.stats.mediator.timedObject.unregister.error", logParams);
543         _logger.log(Level.FINE, "", ex);
544         } finally {
545         ejbTimedObjectStatsImpl = null;
546         }
547     }
548     }
549
550     public void logMonitoredComponentsData(boolean logMethodData) {
551     StringBuffer JavaDoc sbuf = new StringBuffer JavaDoc();
552     sbuf.append("[BEGIN Container-Stats: ").append(ejbName).append("]");
553     ejbStatsProvider.appendStats(sbuf);
554     if (ejbCacheStatsProvider != null) {
555         ejbCacheStatsProvider.appendStats(sbuf);
556     }
557     if (ejbPoolStatsProvider != null) {
558         ejbPoolStatsProvider.appendStats(sbuf);
559     }
560     if (logMethodData) {
561         ejbMethodStatsManager.appendStats(sbuf);
562     }
563     if (ejbTimedObjectStatsProvider != null) {
564         ejbTimedObjectStatsProvider.appendStats(sbuf);
565     }
566     if (sfsbStoreMonitor != null) {
567         sbuf.append((isHAStore ? "[HASFSBStore ": "[SFSBStore "));
568         sfsbStoreMonitor.appendStats(sbuf);
569         sfsbStoreStatsProvider.appendStats(sbuf);
570         sbuf.append("]");
571     }
572     sbuf.append("[END Container-Stats: ").append(ejbName).append("]");
573     _logger.log(Level.INFO, sbuf.toString());
574     }
575
576     private final synchronized MonitoringLevel getCurrentMonitoringLevel() {
577     MonitoringLevel level = MonitoringLevel.OFF;
578     try {
579         Config cfg = ServerBeansFactory.getConfigBean(ApplicationServer.
580         getServerContext().getConfigContext());
581         String JavaDoc levelStr = cfg.getMonitoringService().
582         getModuleMonitoringLevels().getEjbContainer();
583         level = MonitoringLevel.instance(levelStr);
584     } catch (ConfigException configEx) {
585         _logger.log(Level.WARNING, "ejb_base_stats_mediator_configex",
586             configEx);
587     }
588     if (_logger.isLoggable(Level.FINE)) {
589         _logger.log(Level.FINE, "[MonitoringMediator] currentLevel: "
590             + monitoringLevelAsString(level));
591     }
592     return level;
593     }
594
595     private final synchronized boolean isMonitoringOff() {
596     return (this.currentMonitoringLevel == MonitoringLevel.OFF);
597     }
598
599     private final synchronized boolean isMonitoringLow() {
600     return (this.currentMonitoringLevel == MonitoringLevel.LOW);
601     }
602
603     private final synchronized boolean isMonitoringHigh() {
604     return (this.currentMonitoringLevel == MonitoringLevel.HIGH);
605     }
606
607     private static final String JavaDoc monitoringLevelAsString(MonitoringLevel level) {
608     if (level == MonitoringLevel.OFF) {
609         return "OFF";
610     } else if (level == MonitoringLevel.HIGH) {
611         return "HIGH";
612     } else {
613         return "LOW";
614     }
615     }
616
617 }
618
Popular Tags