java.lang.Object
org.eclipse.jetty.jmx.MBeanContainer
- All Implemented Interfaces:
EventListener,org.eclipse.jetty.util.component.Container.InheritedListener,org.eclipse.jetty.util.component.Container.Listener,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable
@ManagedObject("The component that registers beans as MBeans")
public class MBeanContainer
extends Object
implements org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Destroyable
Container class for the MBean instances
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendable -
Field Summary
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
LEGEND -
Constructor Summary
ConstructorsConstructorDescriptionMBeanContainer(MBeanServer server) Constructs MBeanContainerMBeanContainer(MBeanServer server, boolean cacheOtherClassLoaders) Constructs MBeanContainer -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbeanRemoved(org.eclipse.jetty.util.component.Container parent, Object obj) voiddestroy()dump()voiddump(Appendable out, String indent) findBean(ObjectName objectName) Lookup an instance by object nameLookup an object name by instanceRetrieve domain name used to add MBeansRetrieve instance of MBeanServer used by containerbooleanCreates an ObjectMBean for the given object.voidSet domain to be used to add MBeansMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelf
-
Constructor Details
-
MBeanContainer
Constructs MBeanContainer- Parameters:
server- instance of MBeanServer for use by container
-
MBeanContainer
Constructs MBeanContainer- Parameters:
server- instance of MBeanServer for use by containercacheOtherClassLoaders- If true, MBeans from other classloaders (eg WebAppClassLoader) will be cached. The cache is never flushed, so this should be false if some classloaders do not live forever.
-
-
Method Details
-
getMBeanServer
Retrieve instance of MBeanServer used by container- Returns:
- instance of MBeanServer
-
isUseCacheForOtherClassLoaders
@ManagedAttribute(value="Whether to use the cache for MBeans loaded by other ClassLoaders", readonly=true) public boolean isUseCacheForOtherClassLoaders() -
setDomain
Set domain to be used to add MBeans- Parameters:
domain- domain name
-
getDomain
Retrieve domain name used to add MBeans- Returns:
- domain name
-
mbeanFor
Creates an ObjectMBean for the given object.
Attempts to create an ObjectMBean for the object by searching the package and class name space. For example an object of the type:
class com.acme.MyClass extends com.acme.util.BaseClass implements com.acme.Iface
then this method would look for the following classes:
- com.acme.jmx.MyClassMBean
- com.acme.util.jmx.BaseClassMBean
- org.eclipse.jetty.jmx.ObjectMBean
- Parameters:
o- The object- Returns:
- A new instance of an MBean for the object or null.
-
findMBean
Lookup an object name by instance- Parameters:
object- instance for which object name is looked up- Returns:
- object name associated with specified instance, or null if not found
-
findBean
Lookup an instance by object name- Parameters:
objectName- object name of instance- Returns:
- instance associated with specified object name, or null if not found
-
beanAdded
- Specified by:
beanAddedin interfaceorg.eclipse.jetty.util.component.Container.Listener
-
beanRemoved
- Specified by:
beanRemovedin interfaceorg.eclipse.jetty.util.component.Container.Listener
-
makeName
-
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Throws:
IOException
-
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.eclipse.jetty.util.component.Destroyable
-