public class MBeanRegistry extends Object
Constructor and Description |
---|
MBeanRegistry() |
Modifier and Type | Method and Description |
---|---|
static MBeanRegistry |
getInstance() |
MBeanServer |
getPlatformMBeanServer()
Return the underlying MBeanServer that is being
used to register MBean's.
|
Set<ZKMBeanInfo> |
getRegisteredBeans() |
String |
makeFullPath(String prefix,
String... name)
Generate a filesystem-like path.
|
protected String |
makeFullPath(String prefix,
ZKMBeanInfo bean) |
protected ObjectName |
makeObjectName(String path,
ZKMBeanInfo bean)
Builds an MBean path and creates an ObjectName instance using the path.
|
void |
register(ZKMBeanInfo bean,
ZKMBeanInfo parent)
Registers a new MBean with the platform MBean server.
|
static void |
setInstance(MBeanRegistry instance)
Useful for unit tests.
|
void |
unregister(ZKMBeanInfo bean)
Unregister MBean.
|
public static void setInstance(MBeanRegistry instance)
instance
- new instancepublic static MBeanRegistry getInstance()
public MBeanServer getPlatformMBeanServer()
public void register(ZKMBeanInfo bean, ZKMBeanInfo parent) throws JMException
bean
- the bean being registeredparent
- if not null, the new bean will be registered as a child
node of this parent.JMException
public Set<ZKMBeanInfo> getRegisteredBeans()
Collection
with the ZKMBeanInfo
instances not
unregistered. Mainly for testing purposes.public void unregister(ZKMBeanInfo bean)
bean
- public String makeFullPath(String prefix, String... name)
prefix
- path prefixname
- path elementsprotected String makeFullPath(String prefix, ZKMBeanInfo bean)
protected ObjectName makeObjectName(String path, ZKMBeanInfo bean) throws MalformedObjectNameException
path
- MBean pathbean
- the MBean instanceMalformedObjectNameException
Copyright © 2008–2019 The Apache Software Foundation. All rights reserved.