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

RFE: Can't "release" logger instances

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 6, 7
    • Fix Version/s: 7
    • Component/s: core-libs
    • Labels:

      Description

      Name: rmT116609 Date: 11/11/2003


      A DESCRIPTION OF THE REQUEST :
      java.util.logging.LogManager is broken because it doesn't allow Logger's to be released (i.e. once loaded they are loaded forever).

      This has two problems -
      a) creation of lots of Loggers results in memory being lost that can never be reclaimed / released.
      b) In an environment (like an application server) where apps get loaded and unloaded the java 1.4 Logger/LogManager API can be broken because an old instance of the logger is loaded and if you had a resource bundle sub-class associated with it you get a class cast exception when the logger is used again.


      JUSTIFICATION :
      Should be obvious from the description.
      a) If you've finished with a logger you should be able to release it - knowing that there will be a cost re-acquiring it.

      b) For App Servers.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      LogManager.removeLogger(String name) - deletes the cached instance of Logger for name and removes free the logging hierarchy.
      ACTUAL -
      Currently memory is lost and can't force a reload of bundles.

      You can "trick" things by setting the locale to be a different value (which causes the resource bundle cache to reload) - but this is nasty and implementation dependant.

      ---------- BEGIN SOURCE ----------
      // This will cause memory to be exhausted.
      for (int i = 0; i < 10000000; i++) {
         Logger log = Logger.getLogger(new Object().toString());
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is no workaround to the memory problem (a).

      for (b) you can "trick" things by setting the locale to be a different value (which causes the resource bundle cache to reload) - but this is nasty and implementation dependant.
      (Incident Review ID: 225012)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dcubed Daniel Daugherty
                Reporter:
                rmandalasunw Ranjith Mandala (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: