org.objectweb.cjdbc.controller.jmx
Class MBeanServerManager

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.jmx.MBeanServerManager

public class MBeanServerManager
extends java.lang.Object

The MBeanServerManager (Singleton) creates a single MBeanServer in an JVM. The server can be accessed with the getInstance() method.

The server is created with org.objectweb.cjdbc.controller.jmx.MBeanServerBuilder

Version:
1.0
Author:
Marc Wick

Field Summary
private static boolean isJmxEnabled
           
(package private) static Trace logger
           
private static javax.management.MBeanServer mbs
           
 
Constructor Summary
MBeanServerManager()
           
 
Method Summary
static javax.management.MBeanServer getInstance()
          creating a MBeanServer, if it does not exist, otherwise a reference to the MBeanServer is returned
static boolean isJmxEnabled()
          Returns the isJmxEnabled value.
static javax.management.ObjectInstance registerMBean(java.lang.Object object, javax.management.ObjectName name)
          Registers an MBean with the MBean server if jmx is enabled, otherwise it returns null.
static void setJmxEnabled(boolean isJmxEnabled)
          enable or disable jmx
static void unregister(javax.management.ObjectName name)
          unregister an mbean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static Trace logger

mbs

private static javax.management.MBeanServer mbs

isJmxEnabled

private static boolean isJmxEnabled
Constructor Detail

MBeanServerManager

public MBeanServerManager()
Method Detail

getInstance

public static javax.management.MBeanServer getInstance()
creating a MBeanServer, if it does not exist, otherwise a reference to the MBeanServer is returned

Returns:
the mbeanserver instance, null if jmx is disabled

isJmxEnabled

public static boolean isJmxEnabled()
Returns the isJmxEnabled value.

Returns:
Returns the isJmxEnabled.

setJmxEnabled

public static void setJmxEnabled(boolean isJmxEnabled)
                          throws JmxException
enable or disable jmx

Parameters:
isJmxEnabled - The isJmxEnabled to set.
Throws:
JmxException - an exception

registerMBean

public static javax.management.ObjectInstance registerMBean(java.lang.Object object,
                                                            javax.management.ObjectName name)
                                                     throws JmxException
Registers an MBean with the MBean server if jmx is enabled, otherwise it returns null.

This method is equivalend to

 MBeanServer server = MBeanServerManager.getInstance();
 if (server != null)
 {
   server.registerMBean(object, name);
 }
 

Parameters:
object - The MBean to be registered as an MBean.
name - The object name of the MBean. May be null.
Returns:
An ObjectInstance, containing the ObjectName and the Java class name of the newly registered MBean. If the contained ObjectName is n, the contained Java class name is getMBeanInfo(n).getClassName(). Or null if jmx is disabled
Throws:
JmxException - the object could not be registered

unregister

public static void unregister(javax.management.ObjectName name)
                       throws JmxException
unregister an mbean.

Parameters:
name - the name of the bean to unregister
Throws:
JmxException - problems


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.