Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.8.5, 2.0-beta-2
-
Fix Version/s: 1.8.6, 2.0-beta-3
-
Component/s: None
-
Labels:
-
Number of attachments :
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().
Activity
Matt Passell
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | GROOVY-5241.patch [ 58418 ] |
Cedric Champeau
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Cedric Champeau [ melix ] | |
| Fix Version/s | 2.0-beta-3 [ 18244 ] | |
| Fix Version/s | 1.8.6 [ 18245 ] | |
| Resolution | Fixed [ 1 ] |
Jim White
made changes -
| Resolution | Fixed [ 1 ] | |
| Status | Resolved [ 5 ] | Reopened [ 4 ] |
Cedric Champeau
made changes -
| Status | Reopened [ 4 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
This file patches GroovyScriptEngineImpl to use ConcurrentHashMaps.