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

Javaw process taking up 80-90 percent of CPU time!

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b72
    • CPU:
      x86
    • OS:
      windows_vista

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_10"
      Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
      Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows Vista Home Premium with SP1

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Acer Aspire 9420 laptop, Intel(R) Core2 CPU T5500 1.67 GHz, 32 bit, 2 GB RAM

      A DESCRIPTION OF THE PROBLEM :
        Interesting bug I found. I am using the new transparency functionality in my software (http://www.tervola.com/DonkeyTracker). The software creates multiple instances of JDialog with rounded corners. (AWTUtilities.setWindowShape and .setTransparency).

      When I create new JDialog instances with rounded corners and transparency but not yet show up, the javaw process cpu time shoot up over 90 percent!

      BUT after creating those new JDialog instance I briefly flash all those new JDialogs (setVisibility(true)) for about 500 ms and then, javaw process will not take up 80-90 percent of CPU anymore. But without that flashing it runs constantly over 90 until I setVisibility to true for all the JDialogs. After that it runs ok!

      The code difference is this (flashing added:

      for (int c = 0; c < playerKeys.length; c++) {
      HUDPlayer player = (HUDPlayer) playerMap.get(playerKeys[c]);
      player.setVisible(true);
      }
      try {
      Thread.sleep(500);
      } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }
      for (int c = 0; c < playerKeys.length; c++) {
      HUDPlayer player = (HUDPlayer) playerMap.get(playerKeys[c]);
      player.setVisible(false);
      }


      (HUDPlayer extends JDialog implements ImageObserver, ActionListener, HUDNotesListener...)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create multiple JDialogs
      2. Set component listeners for rounding up corners
      3. set transparency
      4. do not show them yet and see how much time those take from CPU.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      java taking 80-90 CPU time.
      ACTUAL -
      java taking 80-90 CPU time.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error messages.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      for (int c = 0; c < playerKeys.length; c++) {
      HUDPlayer player = (HUDPlayer) playerMap.get(playerKeys[c]);
      player.setVisible(true);
      }
      try {
      Thread.sleep(500);
      } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }
      for (int c = 0; c < playerKeys.length; c++) {
      HUDPlayer player = (HUDPlayer) playerMap.get(playerKeys[c]);
      player.setVisible(false);
      }


      (HUDPlayer extends JDialog implements ImageObserver, ActionListener, HUDNotesListener...)

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Show new Jdialogs with rounded corners and transparency for 500 ms and java process will not take anymore all the time of CPU.

        Attachments

          Activity

            People

            Assignee:
            anthony Anthony Petrov (Inactive)
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: