Repository: groovy Updated Branches: refs/heads/master d88050bc9 -> 3ca2577b9
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/3ca2577b Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/3ca2577b Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/3ca2577b Branch: refs/heads/master Commit: 3ca2577b939a3e572cb937a1e46ec820f2952559 Parents: d88050b Author: sunlan <[email protected]> Authored: Wed Jan 3 16:45:55 2018 +0800 Committer: sunlan <[email protected]> Committed: Wed Jan 3 16:46:10 2018 +0800 ---------------------------------------------------------------------- src/main/groovy/groovy/util/ProxyGenerator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/3ca2577b/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..63c0311 100644 --- a/src/main/groovy/groovy/util/ProxyGenerator.java +++ b/src/main/groovy/groovy/util/ProxyGenerator.java @@ -55,7 +55,7 @@ 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(); + public static final ProxyGenerator INSTANCE = new ProxyGenerator(); // TODO should we make ProxyGenerator singleton? static { // wrap the standard MetaClass with the delegate @@ -66,13 +66,15 @@ public class ProxyGenerator { private boolean debug = false; private boolean emptyMethods = false; + private static final String GROOVY_ADAPTER_CACHE_DEFAULT_SIZE_OPT = "groovy.adapter.cache.default.size"; + private static final Integer GROOVY_ADAPTER_CACHE_DEFAULT_SIZE = Integer.getInteger(GROOVY_ADAPTER_CACHE_DEFAULT_SIZE_OPT, 16); /** * 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;
