groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Support config the default size of adapter cache
Date Wed, 03 Jan 2018 10:51:06 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 5206ef753 -> 3cccd8ea6


Support config the default size of adapter cache


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 3cccd8ea67f9773754999e74be15bb0f092915bd
Parents: 5206ef7
Author: sunlan <sunlan@apache.org>
Authored: Wed Jan 3 18:50:48 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Wed Jan 3 18:51:00 2018 +0800

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/3cccd8ea/src/main/groovy/util/ProxyGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/util/ProxyGenerator.java b/src/main/groovy/util/ProxyGenerator.java
index da12b97..ff4c1d5 100644
--- a/src/main/groovy/util/ProxyGenerator.java
+++ b/src/main/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;


Mime
View raw message