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

unexpected exception for MemoryMBean.updateMemoryPools/updateMemoryManagers

    Details

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

      Description



      Name: viR10068 Date: 09/08/2003


      The description for the methods MemoryMBean.updateMemoryPools/updateMemoryManagers
      says nothing about the java.util.ConcurrentModificationException but the
      RI throws it for second call of these methods (MBean access).

      So, the RI or spec should be fixed.

      This bug causes the failure of the JCK test:
      api/java_lang/management/MemoryMBean/index.html#updateMemory

      Source code:
      =========================== mupdate.java ====================================
      import java.io.PrintStream;
      import java.lang.management.*;
      import javax.management.*;

      public class mupdate {

          public static int run(String argv[], PrintStream out) {
              mupdate mupd = new mupdate();
              try {
                  System.out.println("Exit code for updateMemory0101 is " +
      mupd.updateMemory0101());
                  System.out.println("Exit code for updateMemory0101 is " +
      mupd.updateMemory0101());
              } catch (RuntimeMBeanException re) {
                  System.out.println("Unexpected exception: " + re.getTargetException());
                  return 2;
              }
              return 0;
          }

          public static void main(String argv[]) {
              System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
          }

          public int updateMemory0101() {
              final ObjectName objName;
              try {
                  objName = new ObjectName("java.lang:type=Memory");
              } catch (MalformedObjectNameException me) {
                  System.out.println("Unexpected exception: " + me);
                  return 2;
              }
              MBeanServer mbs;
              Object [] paramArr = {};
              String [] signArr = {};
              try {
                  mbs = MBeanServerFactory.createMBeanServer();
                  ManagementFactory.registerMBeans(mbs);
                  mbs.invoke(objName, "updateMemoryPools", paramArr, signArr);
      // or
      // mbs.invoke(objName, "updateMemoryManagers", paramArr, signArr);
                  System.out.println("OKAY");
                  return 0;
              } catch (JMException je) {
                  System.out.println("Unexpected exception: " + je);
                  return 2;
              }
          }
      }

      =======================================================================
      Execution log:
      % jdk1.5.0-b18/solaris-sparc/bin/javac mupdate.java && jdk1.5.0-b18/solaris-sparc/bin/java
      -showversion -Xfuture mupdate
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b18)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b18, mixed mode)

      OKAY
      Exit code for updateMemory0101 is 0
      Unexpected exception: java.util.ConcurrentModificationException
      %

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              mchung Mandy Chung
              Reporter:
              vivsunw Viv Viv (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: