Package org.eclipse.jetty.jmx
Class MBeanContainer
java.lang.Object
org.eclipse.jetty.jmx.MBeanContainer
- All Implemented Interfaces:
EventListener
,Container.InheritedListener
,Container.Listener
,Destroyable
,Dumpable
@ManagedObject("The component that registers beans as MBeans")
public class MBeanContainer
extends Object
implements Container.InheritedListener, Dumpable, Destroyable
Container class for the MBean instances
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMBeanContainer
(MBeanServer server) Constructs MBeanContainerMBeanContainer
(MBeanServer server, boolean cacheOtherClassLoaders) Constructs MBeanContainer -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
beanRemoved
(Container parent, Object obj) void
destroy()
dump()
void
dump
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.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 containerboolean
Creates an ObjectMBean for the given object.void
Set domain to be used to add MBeans
-
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:
beanAdded
in interfaceContainer.Listener
-
beanRemoved
- Specified by:
beanRemoved
in interfaceContainer.Listener
-
makeName
- Parameters:
basis
- name to strip of special characters.- Returns:
- normalized name
-
dump
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dump
in interfaceDumpable
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
dump
-
destroy
public void destroy()- Specified by:
destroy
in interfaceDestroyable
-