JDK-5104947 : Clarify whether ModelMBeanInfoSupport.clone is deep or shallow
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-09-21
  • Updated: 2017-05-16
  • Resolved: 2006-02-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b71Fixed
Related Reports
Relates :  
Description
Suppose you have a ModelMBeanInfoSupport and you want to clone it, i.e.:

    ModelMBeanInfoSupport mmbis1 = ...;
    ModelMBeanInfoSupport mmbis2 =
        (ModelMBeanInfoSupport) mmbis1.clone() ---OR---
        new ModelMBeanInfoSupport(mmbis1);

It is not clear from the specification whether the contained ModelMBeanAttributeInfo elements (and ModelMBeanOperationInfo etc) are cloned, and if they are, whether the contained Descriptors are also cloned.

This can matter, because attribute caching is done by storing the cached value in the Descriptor for the attribute.  So if you create a second MBean that has the same ModelMBeanInfo as an existing one, you actually want it to use a deep copy so that the cached attributes are not stored in the same Descriptor.

The current behaviour of the Reference Implementation is to do a shallow clone (except that the Descriptor of the ModelMBeanInfoSupport is also cloned).  This behaviour is probably acceptable -- implying a bit more work for people who want to duplicate ModelMBeanInfo instances -- but at the very least is should be specified.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
22-09-2004

PUBLIC COMMENTS .
22-09-2004

EVALUATION It may be better to state explicitly that the clone is a shallow clone, and propose an alternative mechanism for attribute caching than storing the cached value in the descriptor. In every other respect, descriptors do not change over the lifetime of an MBean, and can therefore be shared between MBeans. ###@###.### 2004-09-21
21-09-2004