Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5241

GroovyScriptEngineImpl could use ConcurrentHashMaps

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.5, 2.0-beta-2
    • 1.8.6, 2.0-beta-3
    • None

    Description

      The Groovy implementation of JSR-223 (Scripting for the Java Platform), GroovyScriptEngineImpl, uses Collections.synchronizedMap(new HashMap()) for the caches of compiled scripts and closures. Since JSR-223 was first supported in Java 6, it's safe to instead use ConcurrentHashMap for those data structures. According to JCIP (Java Concurrency in Practice), ConcurrentHashMap performs substantially better than Hashtable or Collections.synchronizedMap(). In addition, once ConcurrentHashMaps are used, the code could take advantage of additional methods provided in the ConcurrentMap interface, such as putIfAbsent().

      Attachments

        1. GROOVY-5241.patch
          1 kB
          Matt Passell

        Activity

          People

            melix Cédric Champeau
            mpassell Matt Passell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: