|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jsesoft.mmbi.ModelMBeanInstrumentor
public class ModelMBeanInstrumentor
Instruments (an registers) an arbitrary object as Model MBean.
This class provides JMX Model MBean instrumentation and registration for
objects of arbitrary classes. It is implemented using the
class.
ReflectionInspector
Example:
ModelMBeanInstrumentor instrumentor = new ModelMBeanInstrumentor();
SampleResource resource = new SampleResource();
NamedModelMBean mbean = instrumentor.instrument(resource, "sampleResource");
// do something and let the bean being managed
mbean.unregister();
Constructor Summary | |
---|---|
ModelMBeanInstrumentor(java.lang.Object theManagedResource)
Constructs an instance with Object.class as sentinel. |
|
ModelMBeanInstrumentor(java.lang.Object theManagedResource,
java.lang.Class<?> theSentinel)
Constructs an instance with the specified class as sentinel. |
Method Summary | |
---|---|
NamedModelMBean |
instrument()
Creates a ModelMBean for a managed resource. |
NamedModelMBean |
instrument(java.lang.String nickName)
Creates a ModelMBean for a managed resource and registers it
as JMX MBean. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ModelMBeanInstrumentor(java.lang.Object theManagedResource) throws java.lang.Exception
Object.class
as sentinel.
theManagedResource
- the resource to be managed as Model MBean
java.lang.Exception
- on failure#ModelMBeanInstrumentor(Class)
public ModelMBeanInstrumentor(java.lang.Object theManagedResource, java.lang.Class<?> theSentinel) throws java.lang.Exception
Traversal of the reflection tree is recursive with respect to
inheritance. The sentinel specifies where recursion stops. Default
is Object.class
(see non-parameter constructor
).
theManagedResource
- the resource to be managed as Model MBeantheSentinel
- Class where recursive traversal stops
java.lang.Exception
- on failureMethod Detail |
---|
public NamedModelMBean instrument() throws java.lang.Exception
ModelMBean
for a managed resource.
java.lang.Exception
- if instrumentation failspublic NamedModelMBean instrument(java.lang.String nickName) throws java.lang.Exception
ModelMBean
for a managed resource and registers it
as JMX MBean.
This function is the workhorse of this class. It
NamedModelMBean
instance.nickName
parameter is null, thats it. Otherwise
classnameOfManagedResource:id=nickName-hashCode
nickName
- part of the object name (if null then don't register)
java.lang.Exception
- if instrumentation fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |