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

LogManager - namedLoggers should be ConcurrentHashMap instead of Hashtable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 7
    • core-libs

        A DESCRIPTION OF THE REQUEST :
        private Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<String,LoggerWeakRef>();

        should be converted to:

        private Map<String,LoggerWeakRef> namedLoggers = new ConcurrentHashMap<String,LoggerWeakRef>();

        JUSTIFICATION :
        It improves logging performance due to not having lock contention on retrieval.

        Retrieving a logger happens way more often then adding a new logger.

        already done in other java.lang.util.* classes:
        http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6991380

        also see:
        http://www.ibm.com/developerworks/java/library/j-jtp07233/index.html#N101CD
        http://www.codercorp.com/blog/java/why-concurrenthashmap-is-better-than-hashtable-and-just-as-good-hashmap.html

              dfuchs Daniel Fuchs
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: