@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) @Inherited public @interface MCompositionReference
Use this annotation on fields that reference mbeans
or methods that return references to mbeans
which should be registered and unregistered
if the parent mbean
(the mbean
containing the annotated fields or methods) is registered or unregistered.
Warning:
Only use this annotation on fields or methods that references the same composition mbean
during the whole lifecycle of the parent mbean
.
If one changes the referenced object after the parent mbean
is registered then the framework does not unregister the old composition mbean
and registers the new referenced composition mbean
. Moreover the old composition mbean
will still be strong referenced by the framework and therefore
not garbage collected as long as the parent bean is registered.
Example:
@MBean
("Demo:type=ParentBean") public class ParentBean {@MCompositionReference
private CompositionBean composition = new CompositionBean; }@MBean
("Demo:type=CompositionBean") public class CompositionBean { }
If now one calls:
ParentBean bean = new ParentBean(); MBeans.registerMBeanFor(bean);
then two MBeans get registered the Demo:type=ParentBean
and Demo:type=CompositionBean
.
Moreover, if now one calls:
MBeans.unregisterMBeanFor(bean);
then also both MBeans are unregistered.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
concatName
|
Copyright © 2016 AXON IVY AG. All rights reserved.