United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5104947 Clarify whether ModelMBeanInfoSupport.clone is deep or shallow
JDK-5104947 : Clarify whether ModelMBeanInfoSupport.clone is deep or shallow

Details
Type:
Enhancement
Submit Date:
2004-09-21
Status:
Closed
Updated Date:
2006-06-15
Project Name:
JDK
Resolved Date:
2006-02-04
Component:
core-svc
OS:
generic
Sub-Component:
javax.management
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Relates:

Sub Tasks

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
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
                                     
2004-09-21
PUBLIC COMMENTS

.
                                     
2004-09-22
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mustang


                                     
2004-09-22



Hardware and Software, Engineered to Work Together