KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > jmx > JmxServiceFactory


1 package org.sapia.soto.jmx;
2
3 import org.sapia.soto.jmx.mx4j.Mx4jService;
4
5
6 /**
7  * @author Yanick Duchesne
8  *
9  * <dl>
10  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
11  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
12  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
13  * </dl>
14  */

15 public class JmxServiceFactory {
16   private static JmxService _instance;
17
18   public static synchronized void setDefaultInstance(JmxService service) {
19     _instance = service;
20   }
21
22   public static synchronized JmxService getDefaultInstance()
23     throws Exception JavaDoc {
24     if (_instance == null) {
25       Mx4jService svc = new Mx4jService();
26       svc.init();
27       svc.start();
28       setDefaultInstance(svc);
29     }
30
31     return _instance;
32   }
33 }
34
Popular Tags