Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X c2e2e6bbb -> ca5a54341


Support config the default size of adapter cache

(cherry picked from commit f53e4d8)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/ca5a5434
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ca5a5434
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ca5a5434

Branch: refs/heads/GROOVY_2_5_X
Commit: ca5a54341c8c17fba2e2d229aaaa44f240286896
Parents: c2e2e6b
Author: sunlan <[email protected]>
Authored: Wed Jan 3 17:26:00 2018 +0800
Committer: sunlan <[email protected]>
Committed: Wed Jan 3 18:50:00 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/util/ProxyGenerator.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/ca5a5434/src/main/groovy/groovy/util/ProxyGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/ProxyGenerator.java 
b/src/main/groovy/groovy/util/ProxyGenerator.java
index da12b97..ff4c1d5 100644
--- a/src/main/groovy/groovy/util/ProxyGenerator.java
+++ b/src/main/groovy/groovy/util/ProxyGenerator.java
@@ -55,8 +55,6 @@ public class ProxyGenerator {
     private static final Map<Object,Object> EMPTY_CLOSURE_MAP = 
Collections.emptyMap();
     private static final Set<String> EMPTY_KEYSET = Collections.emptySet();
 
-    public static final ProxyGenerator INSTANCE = new ProxyGenerator();
-
     static {
         // wrap the standard MetaClass with the delegate
         
setMetaClass(GroovySystem.getMetaClassRegistry().getMetaClass(ProxyGenerator.class));
@@ -66,13 +64,17 @@ public class ProxyGenerator {
     private boolean debug = false;
     private boolean emptyMethods = false;
 
+    private static final Integer GROOVY_ADAPTER_CACHE_DEFAULT_SIZE = 
Integer.getInteger("groovy.adapter.cache.default.size", 16);
+
+    public static final ProxyGenerator INSTANCE = new ProxyGenerator(); // 
TODO should we make ProxyGenerator singleton?
+
     /**
      * The adapter cache is used to cache proxy classes. When, for example, a 
call like:
      * map as MyClass is found, then a lookup is made into the cache to find 
if a suitable
      * adapter already exists. If so, then the class is reused, instead of 
generating a
      * new class.
      */
-    private final LRUCache adapterCache = new LRUCache(16);
+    private final LRUCache adapterCache = new 
LRUCache(GROOVY_ADAPTER_CACHE_DEFAULT_SIZE);
 
     public boolean getDebug() {
         return debug;

Reply via email to