public abstract class AbstractJmxBridge<MXBean> extends Object
This implementation keeps a weak reference to the underlying implementation so that failing to unregister from the platform MBean
server does not leak implementation instances. In the event of usage after the implementation is garbage collected, an IllegalStateException is thrown.
The idiomatic usage of this class is to subclass, pass the MXBean interface type as parameter, directly implement the MXBean
using a strong reference to the required system components, and override getMXBean() to return this. The
register() method will construct a proxy which weakly references this implementation.
| Constructor and Description |
|---|
AbstractJmxBridge(ObjectName objectName,
Class<MXBean> mxBeanClass)
Construct given JMX ObjectName and interface class.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract MXBean |
getMXBean()
Obtain the actual MXBean implementation.
|
ObjectName |
getObjectName() |
void |
register()
Register the MXBean with the platform MBean server.
|
void |
unregister()
Unregister the MXBean from the platform MBean server.
|
public AbstractJmxBridge(ObjectName objectName, Class<MXBean> mxBeanClass)
objectName - the ObjectName to register under.mxBeanClass - the interface class for the MXBean.protected abstract MXBean getMXBean()
The return value is weakly held.
public void register()
public ObjectName getObjectName()
public void unregister()
Copyright © 2019 Atlassian. All rights reserved.