Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5104947

Clarify whether ModelMBeanInfoSupport.clone is deep or shallow

    Details

    • Subcomponent:
    • Resolved In Build:
      b71
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emcmanus Eamonn McManus
                Reporter:
                emcmanus Eamonn McManus
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: