You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mc...@apache.org on 2011/10/16 23:33:36 UTC

svn commit: r1184938 - in /commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl: OgnlRuntime.java internal/entry/ConstructorCacheEntryFactory.java

Author: mcucchiara
Date: Sun Oct 16 21:33:35 2011
New Revision: 1184938

URL: http://svn.apache.org/viewvc?rev=1184938&view=rev
Log:
added flyweight implementation of constructor cache

Removed:
    commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/ConstructorCacheEntryFactory.java
Modified:
    commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/OgnlRuntime.java

Modified: commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/OgnlRuntime.java?rev=1184938&r1=1184937&r2=1184938&view=diff
==============================================================================
--- commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/OgnlRuntime.java (original)
+++ commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/OgnlRuntime.java Sun Oct 16 21:33:35 2011
@@ -30,7 +30,6 @@ import org.apache.commons.ognl.internal.
 import org.apache.commons.ognl.internal.ConcurrentClassCache;
 import org.apache.commons.ognl.internal.ConcurrentHashMapCache;
 import org.apache.commons.ognl.internal.entry.CacheEntryFactory;
-import org.apache.commons.ognl.internal.entry.ConstructorCacheEntryFactory;
 import org.apache.commons.ognl.internal.entry.DeclaredMethodCacheEntry;
 import org.apache.commons.ognl.internal.entry.DeclaredMethodCacheEntryFactory;
 import org.apache.commons.ognl.internal.entry.FiedlCacheEntryFactory;
@@ -59,6 +58,7 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.security.Permission;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -164,7 +164,14 @@ public class OgnlRuntime
     static final ClassCache<Map<String, PropertyDescriptor>> _propertyDescriptorCache =
         new ConcurrentClassCache<Map<String, PropertyDescriptor>>(new PropertyDescriptorCacheEntryFactory());
 
-    static final ClassCache<List<Constructor<?>>> _constructorCache = new ConcurrentClassCache<List<Constructor<?>>>(new ConstructorCacheEntryFactory() );
+    static final ClassCache<List<Constructor<?>>> _constructorCache = new ConcurrentClassCache<List<Constructor<?>>>(new CacheEntryFactory<Class<?>, List<Constructor<?>>>( )
+    {
+        public List<Constructor<?>> create( Class<?> key )
+            throws CacheException
+        {
+            return Arrays.asList( key.getConstructors( ) );
+        }
+    } );
 
     static final ConcurrentHashMapCache<DeclaredMethodCacheEntry, Map<String, List<Method>>> _methodCache =
         new ConcurrentHashMapCache<DeclaredMethodCacheEntry, Map<String, List<Method>>>(