You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Adrian Crum <ad...@sandglass-software.com> on 2011/10/24 01:29:17 UTC
Re: svn commit: r1188000 [1/3] - in /commons/proper/ognl/trunk: ./
src/main/java/org/apache/commons/ognl/ src/main/java/org/apache/commons/ognl/enhance/
src/main/java/org/apache/commons/ognl/internal/ src/main/java/org/apache/commons/ognl/internal/entry/
s...
This commit appears to contain a lot of formatting changes that have
nothing to do with synchronization. Also, interface method declarations
do not require the public keyword.
-Adrian
On 10/24/2011 12:10 AM, mcucchiara@apache.org wrote:
> Author: mcucchiara
> Date: Sun Oct 23 23:10:24 2011
> New Revision: 1188000
>
> URL: http://svn.apache.org/viewvc?rev=1188000&view=rev
> Log:
> OGNL-20 - Performance - Replace synchronized blocks with ReentrantReadWriteLock
>
> Added:
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/Cache.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/Cache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/CacheException.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/CacheException.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/CacheFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/CacheFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ClassCacheHandler.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/ClassCacheHandler.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCache.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapClassCache.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/ConcurrentHashMapClassCache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/HashMapCache.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/HashMapCache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/HashMapCacheFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/HashMapCacheFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/HashMapClassCache.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/HashMapClassCache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockCache.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockCache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockCacheFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockCacheFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockClassCache.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/ReentrantReadWriteLockClassCache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/
> - copied from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/CacheEntry.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/CacheEntry.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/CacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/CacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/ClassCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/ClassCacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntry.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntry.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/DeclaredMethodCacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/FiedlCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/FiedlCacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeCacheEntry.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeCacheEntry.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/GenericMethodParameterTypeFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessCacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessEntryValue.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodAccessEntryValue.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntry.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodCacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/MethodPermCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/MethodPermCacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntry.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntry.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/PermissionCacheEntryFactory.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/entry/PropertyDescriptorCacheEntryFactory.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/main/java/org/apache/commons/ognl/internal/entry/PropertyDescriptorCacheEntryFactory.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/
> - copied from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/ConcurrentHashMapCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/ConstructorCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/ConstructorCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/DeclaredMethodCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/DeclaredMethodCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/FieldCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/FieldCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/GenericMethodParameterTypeCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/GenericMethodParameterTypeCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/MethodAccessCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/MethodAccessCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/MethodPermCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/MethodPermCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/PermissionCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/PermissionCacheTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/internal/PropertyDescriptorCacheTest.java
> - copied unchanged from r1187982, commons/proper/ognl/branches/new-cache-approach/src/test/java/org/apache/commons/ognl/internal/PropertyDescriptorCacheTest.java
> Modified:
> commons/proper/ognl/trunk/ (props changed)
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAnd.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAssign.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitAnd.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitOr.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/EvaluationPool.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MethodAccessor.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectArrayPool.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlOps.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ClassCache.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/ClassCacheImpl.java
> commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/internal/Entry.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ContextVariableTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexAccessTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InterfaceInheritanceTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MethodWithConversionTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/NestedMethodTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/NullHandlerTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/OgnlTestCase.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/OperatorTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/Performance.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateAccessorTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/QuotingTest.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/objects/Bean1.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/objects/Bean2.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/objects/Bean3.java
> commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/objects/Root.java
>
> Propchange: commons/proper/ognl/trunk/
> ------------------------------------------------------------------------------
> --- svn:mergeinfo (added)
> +++ svn:mergeinfo Sun Oct 23 23:10:24 2011
> @@ -0,0 +1 @@
> +/commons/proper/ognl/branches/new-cache-approach:1181007-1187982
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java Sun Oct 23 23:10:24 2011
> @@ -52,7 +52,7 @@ class ASTAdd
> {
> Object result = _children[0].getValue( context, source );
>
> - for ( int i = 1; i< _children.length; ++i )
> + for ( int i = 1; i< _children.length; ++i )
> {
> result = OgnlOps.add( result, _children[i].getValue( context, source ) );
> }
> @@ -67,34 +67,34 @@ class ASTAdd
>
> boolean isWider( NodeType type, NodeType lastType )
> {
> - if ( lastType == null )
> + if ( lastType == null )
> {
> return true;
> }
>
> // System.out.println("checking isWider(" + type.getGetterClass() + " , " + lastType.getGetterClass() + ")");
>
> - if ( String.class.isAssignableFrom( lastType.getGetterClass() ) )
> + if ( String.class.isAssignableFrom( lastType.getGetterClass() ) )
> {
> return false;
> }
>
> - if ( String.class.isAssignableFrom( type.getGetterClass() ) )
> + if ( String.class.isAssignableFrom( type.getGetterClass() ) )
> {
> return true;
> }
>
> - if ( _parent != null&& String.class.isAssignableFrom( type.getGetterClass() ) )
> + if ( _parent != null&& String.class.isAssignableFrom( type.getGetterClass() ) )
> {
> return true;
> }
>
> - if ( String.class.isAssignableFrom( lastType.getGetterClass() )&& Object.class == type.getGetterClass() )
> + if ( String.class.isAssignableFrom( lastType.getGetterClass() )&& Object.class == type.getGetterClass() )
> {
> return false;
> }
>
> - if ( _parent != null&& String.class.isAssignableFrom( lastType.getGetterClass() ) )
> + if ( _parent != null&& String.class.isAssignableFrom( lastType.getGetterClass() ) )
> {
> return false;
> }
> @@ -182,15 +182,15 @@ class ASTAdd
>
> for ( int i = 0; i< _children.length; ++i )
> {
> - if ( i> 0 )
> + if ( i> 0 )
> {
> result += " " + getExpressionOperator( i ) + " ";
> }
> -
> +
> String expr = _children[i].toGetSourceString( context, target );
>
> if ( ( expr != null&& "null".equals( expr ) )
> - || ( !ASTConst.class.isInstance( _children[i] )
> + || ( !ASTConst.class.isInstance( _children[i] )
> && ( expr == null || expr.trim().length()<= 0 ) ) )
> {
> expr = "null";
> @@ -234,7 +234,7 @@ class ASTAdd
> ExpressionCompiler.getRootExpression( _children[i], context.getRoot(), context );
>
> if ( !ASTProperty.class.isInstance( _children[i].jjtGetChild( 0 ) )&& rootExpr.endsWith( ")" )
> -&& expr.startsWith( ")" ) )
> +&& expr.startsWith( ")" ) )
> {
> expr = expr.substring( 1, expr.length() );
> }
> @@ -243,7 +243,7 @@ class ASTAdd
> context.setCurrentAccessor( context.getRoot().getClass() );
>
> String cast = (String) context.remove( ExpressionCompiler.PRE_CAST );
> - if ( cast == null )
> + if ( cast == null )
> {
> cast = "";
> }
> @@ -297,7 +297,7 @@ class ASTAdd
> {
> if ( ASTVarRef.class.isInstance( _children[i] )
> || ASTProperty.class.isInstance( _children[i] )
> - || ASTChain.class.isInstance( _children[i] ) )
> + || ASTChain.class.isInstance( _children[i] ) )
> {
> result += ".";
> }
> @@ -307,7 +307,7 @@ class ASTAdd
> }
> }
>
> - if ( lastType != null )
> + if ( lastType != null )
> {
> context.setCurrentAccessor( lastType.getGetterClass() );
> }
> @@ -316,7 +316,7 @@ class ASTAdd
>
> if ( _parent == null || ASTSequence.class.isAssignableFrom( _parent.getClass() ) )
> {
> - if ( _getterClass != null&& String.class.isAssignableFrom( _getterClass ) )
> + if ( _getterClass != null&& String.class.isAssignableFrom( _getterClass ) )
> {
> _getterClass = Object.class;
> }
> @@ -346,7 +346,6 @@ class ASTAdd
> }
>
> public<R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
> - throws OgnlException
> {
> return visitor.visit( this, data );
> }
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAnd.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAnd.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAnd.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAnd.java Sun Oct 23 23:10:24 2011
> @@ -72,7 +72,7 @@ public class ASTAnd
> {
> result = _children[i].getValue( context, source );
>
> - if ( i != last&& !OgnlOps.booleanValue( result ) )
> + if ( i != last&& !OgnlOps.booleanValue( result ) )
> {
> break;
> }
> @@ -93,7 +93,7 @@ public class ASTAnd
> {
> Object v = _children[i].getValue( context, target );
>
> - if ( !OgnlOps.booleanValue( v ) )
> + if ( !OgnlOps.booleanValue( v ) )
> {
> return;
> }
> @@ -123,12 +123,12 @@ public class ASTAnd
> */
> public String toGetSourceString( OgnlContext context, Object target )
> {
> - if ( _children.length != 2 )
> + if ( _children.length != 2 )
> {
> throw new UnsupportedCompilationException(
> "Can only compile boolean expressions with two children." );
> }
> -
> +
> String result = "";
>
> try
> @@ -141,17 +141,17 @@ public class ASTAnd
> "And expression can't be compiled until all conditions are true." );
> }
>
> - if ( !OgnlRuntime.isBoolean( first )&& !context.getCurrentType().isPrimitive() )
> + if ( !OgnlRuntime.isBoolean( first )&& !context.getCurrentType().isPrimitive() )
> {
> first = OgnlRuntime.getCompiler( context ).createLocalReference( context, first, context.getCurrentType() );
> }
> -
> +
> String second = OgnlRuntime.getChildSource( context, target, _children[1] );
> - if ( !OgnlRuntime.isBoolean( second )&& !context.getCurrentType().isPrimitive() )
> + if ( !OgnlRuntime.isBoolean( second )&& !context.getCurrentType().isPrimitive() )
> {
> second = OgnlRuntime.getCompiler( context ).createLocalReference( context, second, context.getCurrentType() );
> }
> -
> +
> result += "(org.apache.commons.ognl.OgnlOps.booleanValue(" + first + ")";
>
> result += " ? ";
> @@ -184,13 +184,13 @@ public class ASTAnd
> */
> public String toSetSourceString( OgnlContext context, Object target )
> {
> - if ( _children.length != 2 )
> + if ( _children.length != 2 )
> {
> throw new UnsupportedCompilationException( "Can only compile boolean expressions with two children." );
> }
> -
> +
> String pre = (String) context.get( "_currentChain" );
> - if ( pre == null )
> + if ( pre == null )
> {
> pre = "";
> }
> @@ -216,15 +216,15 @@ public class ASTAnd
> ExpressionCompiler.getRootExpression( _children[1], context.getRoot(), context ) + pre
> + _children[1].toSetSourceString( context, target );
>
> - if ( !OgnlRuntime.isBoolean( first ) )
> + if ( !OgnlRuntime.isBoolean( first ) )
> {
> result += "if(org.apache.commons.ognl.OgnlOps.booleanValue(" + first + ")){";
> - }
> - else
> + }
> + else
> {
> result += "if(" + first + "){";
> }
> -
> +
> result += second;
> result += "; } ";
>
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAssign.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAssign.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAssign.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAssign.java Sun Oct 23 23:10:24 2011
> @@ -69,11 +69,11 @@ class ASTAssign
> context.setCurrentType( Object.class );
>
> String core = seq.getCoreExpression();
> - if ( core.endsWith( ";" ) )
> + if ( core.endsWith( ";" ) )
> {
> core = core.substring( 0, core.lastIndexOf( ";" ) );
> }
> -
> +
> second =
> OgnlRuntime.getCompiler( context ).createLocalReference( context,
> "org.apache.commons.ognl.OgnlOps.returnValue(($w)"
> @@ -122,12 +122,12 @@ class ASTAssign
>
> String value = _children[1].toSetSourceString( context, target );
>
> - if ( value == null )
> + if ( value == null )
> {
> throw new UnsupportedCompilationException(
> "Value for assignment is null, can't enhance statement to bytecode." );
> }
> -
> +
> if ( ASTSequence.class.isAssignableFrom( _children[1].getClass() ) )
> {
> ASTSequence seq = (ASTSequence) _children[1];
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitAnd.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitAnd.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitAnd.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitAnd.java Sun Oct 23 23:10:24 2011
> @@ -46,7 +46,7 @@ class ASTBitAnd
> throws OgnlException
> {
> Object result = _children[0].getValue( context, source );
> - for ( int i = 1; i< _children.length; ++i )
> + for ( int i = 1; i< _children.length; ++i )
> {
> result = OgnlOps.binaryAnd( result, _children[i].getValue( context, source ) );
> }
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitOr.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitOr.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitOr.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTBitOr.java Sun Oct 23 23:10:24 2011
> @@ -20,7 +20,7 @@ package org.apache.commons.ognl;
> */
>
> /**
> - * $Id$
> + * $Id$
> * @author Luke Blanshard (blanshlu@netscape.net)
> * @author Drew Davidson (drew@ognl.org)
> */
> @@ -46,7 +46,7 @@ class ASTBitOr
> throws OgnlException
> {
> Object result = _children[0].getValue( context, source );
> - for ( int i = 1; i< _children.length; ++i )
> + for ( int i = 1; i< _children.length; ++i )
> {
> result = OgnlOps.binaryOr( result, _children[i].getValue( context, source ) );
> }
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java Sun Oct 23 23:10:24 2011
> @@ -209,8 +209,7 @@ public class ArrayPropertyAccessor
> indexStr = "org.apache.commons.ognl.OgnlOps#getIntValue(" + indexStr + toString + ")";
> }
>
> - Class<? extends Object> type =
> - target.getClass().isArray() ? target.getClass().getComponentType() : target.getClass();
> + Class<? extends Object> type = target.getClass().isArray() ? target.getClass().getComponentType() : target.getClass();
>
> context.setCurrentAccessor( target.getClass() );
> context.setCurrentType( target.getClass().getComponentType() );
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java Sun Oct 23 23:10:24 2011
> @@ -33,6 +33,7 @@ public class DefaultTypeConverter
> {
>
> public<T> T convertValue( Map<String, Object> context, Object value, Class<T> toType )
> + throws OgnlException
> {
> @SuppressWarnings( "unchecked" ) // type checking performed in OgnlOps.convertValue( value, toType )
> T ret = (T) OgnlOps.convertValue( value, toType );
> @@ -44,6 +45,7 @@ public class DefaultTypeConverter
> */
> public<T> T convertValue( Map<String, Object> context, Object target, Member member, String propertyName, Object value,
> Class<T> toType )
> + throws OgnlException
> {
> return convertValue( context, value, toType );
> }
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/EvaluationPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/EvaluationPool.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/EvaluationPool.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/EvaluationPool.java Sun Oct 23 23:10:24 2011
> @@ -19,35 +19,22 @@ package org.apache.commons.ognl;
> * under the License.
> */
>
> -import java.util.ArrayList;
> import java.util.List;
>
> +/**
> + * @deprecated evaluation-pooling now relies on the jvm garbage collection
> + */
> public final class EvaluationPool
> {
> - private final List<Evaluation> evaluations = new ArrayList<Evaluation>();
> -
> - private int size = 0;
> -
> - private int created = 0;
> -
> - private int recovered = 0;
> -
> - private int recycled = 0;
> -
> - public EvaluationPool()
> + public EvaluationPool( )
> {
> this( 0 );
> }
>
> public EvaluationPool( int initialSize )
> {
> - super();
> - for ( int i = 0; i< initialSize; i++ )
> - {
> - evaluations.add( new Evaluation( null, null ) );
> - }
> - created = initialSize;
> - size = initialSize;
> + super( );
> + // do not init object pooling
> }
>
> /**
> @@ -60,98 +47,87 @@ public final class EvaluationPool
> }
>
> /**
> - * Returns an Evaluation that contains the node, source and whether it is a set operation. If there are no
> - * Evaluation objects in the pool one is created and returned.
> + * Returns an Evaluation that contains the node, source and whether it
> + * is a set operation.
> */
> - public synchronized Evaluation create( SimpleNode node, Object source, boolean setOperation )
> + public Evaluation create( SimpleNode node, Object source, boolean setOperation )
> {
> - Evaluation result;
> -
> - if ( size> 0 )
> - {
> - result = evaluations.remove( size - 1 );
> - result.init( node, source, setOperation );
> - size--;
> - recovered++;
> - }
> - else
> - {
> - result = new Evaluation( node, source, setOperation );
> - created++;
> - }
> - return result;
> + // synchronization is removed as we do not rely anymore on the in-house object pooling
> + return new Evaluation( node, source, setOperation );
> }
>
> /**
> * Recycles an Evaluation
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> */
> - public synchronized void recycle( Evaluation value )
> + public void recycle( Evaluation value )
> {
> - if ( value != null )
> - {
> - value.reset();
> - evaluations.add( value );
> - size++;
> - recycled++;
> - }
> + // no need of recycling, we rely on the garbage collection efficiency
> }
>
> /**
> - * Recycles an of Evaluation and all of it's siblings and children.
> + * Recycles an of Evaluation and all of it's siblings
> + * and children.
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> */
> public void recycleAll( Evaluation value )
> {
> - if ( value != null )
> - {
> - recycleAll( value.getNext() );
> - recycleAll( value.getFirstChild() );
> - recycle( value );
> - }
> + // no need of recycling, we rely on the garbage collection efficiency
> }
>
> /**
> * Recycles a List of Evaluation objects
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> */
> - public void recycleAll( List<Evaluation> value )
> + public void recycleAll( List value )
> {
> - if ( value != null )
> - {
> - for ( int i = 0, icount = value.size(); i< icount; i++ )
> - {
> - recycle( value.get( i ) );
> - }
> - }
> + // no need of recycling, we rely on the garbage collection efficiency
> }
>
> /**
> * Returns the number of items in the pool
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> */
> - public int getSize()
> + public int getSize( )
> {
> - return size;
> + return 0;
> }
>
> /**
> - * Returns the number of items this pool has created since it's construction.
> + * Returns the number of items this pool has created since
> + * it's construction.
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> */
> - public int getCreatedCount()
> + public int getCreatedCount( )
> {
> - return created;
> + return 0;
> }
>
> /**
> - * Returns the number of items this pool has recovered from the pool since its construction.
> + * Returns the number of items this pool has recovered from
> + * the pool since its construction.
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> */
> - public int getRecoveredCount()
> + public int getRecoveredCount( )
> {
> - return recovered;
> + return 0;
> }
>
> /**
> - * Returns the number of items this pool has recycled since it's construction.
> + * Returns the number of items this pool has recycled since
> + * it's construction.
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> */
> - public int getRecycledCount()
> + public int getRecycledCount( )
> {
> - return recycled;
> + return 0;
> }
> }
> +
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ExpressionNode.java Sun Oct 23 23:10:24 2011
> @@ -113,13 +113,13 @@ public abstract class ExpressionNode
> {
> pre = "";
> }
> -
> +
> String cast = (String) context.remove( ExpressionCompiler.PRE_CAST );
> if ( cast == null )
> {
> cast = "";
> }
> -
> +
> value =
> cast + ExpressionCompiler.getRootExpression( _children[i], context.getRoot(), context ) + pre
> + value;
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MethodAccessor.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MethodAccessor.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MethodAccessor.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MethodAccessor.java Sun Oct 23 23:10:24 2011
> @@ -41,7 +41,7 @@ public interface MethodAccessor
> * @exception MethodFailedException if there is an error calling the method
> */
> Object callStaticMethod( Map<String, Object> context, Class<?> targetClass, String methodName, Object[] args )
> - throws MethodFailedException;
> + throws OgnlException;
>
> /**
> * Calls the method named with the arguments given.
> @@ -54,5 +54,5 @@ public interface MethodAccessor
> * @exception MethodFailedException if there is an error calling the method
> */
> Object callMethod( Map<String, Object> context, Object target, String methodName, Object[] args )
> - throws MethodFailedException;
> + throws OgnlException;
> }
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java Sun Oct 23 23:10:24 2011
> @@ -22,50 +22,50 @@ package org.apache.commons.ognl;
>
> public interface NodeVisitor<R, P>
> {
> - public R visit(ASTSequence node, P data) throws OgnlException;
> - public R visit(ASTAssign node, P data) throws OgnlException;
> - public R visit(ASTTest node, P data) throws OgnlException;
> - public R visit(ASTOr node, P data) throws OgnlException;
> - public R visit(ASTAnd node, P data) throws OgnlException;
> - public R visit(ASTBitOr node, P data) throws OgnlException;
> - public R visit(ASTXor node, P data) throws OgnlException;
> - public R visit(ASTBitAnd node, P data) throws OgnlException;
> - public R visit(ASTEq node, P data) throws OgnlException;
> - public R visit(ASTNotEq node, P data) throws OgnlException;
> - public R visit(ASTLess node, P data) throws OgnlException;
> - public R visit(ASTGreater node, P data) throws OgnlException;
> - public R visit(ASTLessEq node, P data) throws OgnlException;
> - public R visit(ASTGreaterEq node, P data) throws OgnlException;
> - public R visit(ASTIn node, P data) throws OgnlException;
> - public R visit(ASTNotIn node, P data) throws OgnlException;
> - public R visit(ASTShiftLeft node, P data) throws OgnlException;
> - public R visit(ASTShiftRight node, P data) throws OgnlException;
> - public R visit(ASTUnsignedShiftRight node, P data) throws OgnlException;
> - public R visit(ASTAdd node, P data) throws OgnlException;
> - public R visit(ASTSubtract node, P data) throws OgnlException;
> - public R visit(ASTMultiply node, P data) throws OgnlException;
> - public R visit(ASTDivide node, P data) throws OgnlException;
> - public R visit(ASTRemainder node, P data) throws OgnlException;
> - public R visit(ASTNegate node, P data) throws OgnlException;
> - public R visit(ASTBitNegate node, P data) throws OgnlException;
> - public R visit(ASTNot node, P data) throws OgnlException;
> - public R visit(ASTInstanceof node, P data) throws OgnlException;
> - public R visit(ASTChain node, P data) throws OgnlException;
> - public R visit(ASTEval node, P data) throws OgnlException;
> - public R visit(ASTConst node, P data) throws OgnlException;
> - public R visit(ASTThisVarRef node, P data) throws OgnlException;
> - public R visit(ASTRootVarRef node, P data) throws OgnlException;
> - public R visit(ASTVarRef node, P data) throws OgnlException;
> - public R visit(ASTList node, P data) throws OgnlException;
> - public R visit(ASTMap node, P data) throws OgnlException;
> - public R visit(ASTKeyValue node, P data) throws OgnlException;
> - public R visit(ASTStaticField node, P data) throws OgnlException;
> - public R visit(ASTCtor node, P data) throws OgnlException;
> - public R visit(ASTProperty node, P data) throws OgnlException;
> - public R visit(ASTStaticMethod node, P data) throws OgnlException;
> - public R visit(ASTMethod node, P data) throws OgnlException;
> - public R visit(ASTProject node, P data) throws OgnlException;
> - public R visit(ASTSelect node, P data) throws OgnlException;
> - public R visit(ASTSelectFirst node, P data) throws OgnlException;
> - public R visit(ASTSelectLast node, P data) throws OgnlException;
> + public R visit(ASTSequence node, P data);
> + public R visit(ASTAssign node, P data);
> + public R visit(ASTTest node, P data);
> + public R visit(ASTOr node, P data);
> + public R visit(ASTAnd node, P data);
> + public R visit(ASTBitOr node, P data);
> + public R visit(ASTXor node, P data);
> + public R visit(ASTBitAnd node, P data);
> + public R visit(ASTEq node, P data);
> + public R visit(ASTNotEq node, P data);
> + public R visit(ASTLess node, P data);
> + public R visit(ASTGreater node, P data);
> + public R visit(ASTLessEq node, P data);
> + public R visit(ASTGreaterEq node, P data);
> + public R visit(ASTIn node, P data);
> + public R visit(ASTNotIn node, P data);
> + public R visit(ASTShiftLeft node, P data);
> + public R visit(ASTShiftRight node, P data);
> + public R visit(ASTUnsignedShiftRight node, P data);
> + public R visit(ASTAdd node, P data);
> + public R visit(ASTSubtract node, P data);
> + public R visit(ASTMultiply node, P data);
> + public R visit(ASTDivide node, P data);
> + public R visit(ASTRemainder node, P data);
> + public R visit(ASTNegate node, P data);
> + public R visit(ASTBitNegate node, P data);
> + public R visit(ASTNot node, P data);
> + public R visit(ASTInstanceof node, P data);
> + public R visit(ASTChain node, P data);
> + public R visit(ASTEval node, P data);
> + public R visit(ASTConst node, P data);
> + public R visit(ASTThisVarRef node, P data);
> + public R visit(ASTRootVarRef node, P data);
> + public R visit(ASTVarRef node, P data);
> + public R visit(ASTList node, P data);
> + public R visit(ASTMap node, P data);
> + public R visit(ASTKeyValue node, P data);
> + public R visit(ASTStaticField node, P data);
> + public R visit(ASTCtor node, P data);
> + public R visit(ASTProperty node, P data);
> + public R visit(ASTStaticMethod node, P data);
> + public R visit(ASTMethod node, P data);
> + public R visit(ASTProject node, P data);
> + public R visit(ASTSelect node, P data);
> + public R visit(ASTSelectFirst node, P data);
> + public R visit(ASTSelectLast node, P data);
> }
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectArrayPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectArrayPool.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectArrayPool.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectArrayPool.java Sun Oct 23 23:10:24 2011
> @@ -19,147 +19,26 @@ package org.apache.commons.ognl;
> * under the License.
> */
>
> -import java.util.ArrayList;
> -import java.util.Arrays;
> -import java.util.List;
> -
> +/**
> + * This class was previously intended to produce performance improvement.<br>
> + * This hand-made object pooling is now a bottleneck under high load.<br>
> + * We now rely on the new jvm garbage collection improvements to handle object allocation efficiently.
> + *
> + * @deprecated object-pooling now relies on the jvm garbage collection
> + */
> public final class ObjectArrayPool
> {
> - private final IntHashMap<Integer, SizePool> pools = new IntHashMap<Integer, SizePool>( 23 );
> -
> - public static class SizePool
> + public ObjectArrayPool( )
> {
> - private final List<Object[]> arrays = new ArrayList<Object[]>();
> -
> - private int arraySize;
> -
> - private int size;
> -
> - private int created = 0;
> -
> - private int recovered = 0;
> -
> - private int recycled = 0;
> -
> - public SizePool( int arraySize )
> - {
> - this( arraySize, 0 );
> - }
> -
> - public SizePool( int arraySize, int initialSize )
> - {
> - super();
> - this.arraySize = arraySize;
> - for ( int i = 0; i< initialSize; i++ )
> - {
> - arrays.add( new Object[arraySize] );
> - }
> - created = size = initialSize;
> - }
> -
> - public int getArraySize()
> - {
> - return arraySize;
> - }
> -
> - public Object[] create()
> - {
> - Object[] result;
> -
> - if ( size> 0 )
> - {
> - result = arrays.remove( size - 1 );
> - size--;
> - recovered++;
> - }
> - else
> - {
> - result = new Object[arraySize];
> - created++;
> - }
> - return result;
> - }
> -
> - public synchronized void recycle( Object[] value )
> - {
> - if ( value != null )
> - {
> - if ( value.length != arraySize )
> - {
> - throw new IllegalArgumentException( "recycled array size " + value.length
> - + " inappropriate for pool array size " + arraySize );
> - }
> - Arrays.fill( value, null );
> - arrays.add( value );
> - size++;
> - recycled++;
> - }
> - else
> - {
> - throw new IllegalArgumentException( "cannot recycle null object" );
> - }
> - }
> -
> - /**
> - * Returns the number of items in the pool
> - */
> - public int getSize()
> - {
> - return size;
> - }
> -
> - /**
> - * Returns the number of items this pool has created since it's construction.
> - */
> - public int getCreatedCount()
> - {
> - return created;
> - }
> -
> - /**
> - * Returns the number of items this pool has recovered from the pool since its construction.
> - */
> - public int getRecoveredCount()
> - {
> - return recovered;
> - }
> -
> - /**
> - * Returns the number of items this pool has recycled since it's construction.
> - */
> - public int getRecycledCount()
> - {
> - return recycled;
> - }
> - }
> -
> - public ObjectArrayPool()
> - {
> - super();
> - }
> -
> - public IntHashMap<Integer, SizePool> getSizePools()
> - {
> - return pools;
> - }
> -
> - public synchronized SizePool getSizePool( int arraySize )
> - {
> - SizePool result = pools.get( arraySize );
> -
> - if ( result == null )
> - {
> - pools.put( arraySize, result = new SizePool( arraySize ) );
> - }
> - return result;
> + super( );
> }
>
> - public synchronized Object[] create( int arraySize )
> + public Object[] create( int arraySize )
> {
> - return getSizePool( arraySize ).create();
> + return new Object[arraySize];
> }
>
> - public synchronized Object[] create( Object singleton )
> + public Object[] create( Object singleton )
> {
> Object[] result = create( 1 );
>
> @@ -167,7 +46,7 @@ public final class ObjectArrayPool
> return result;
> }
>
> - public synchronized Object[] create( Object object1, Object object2 )
> + public Object[] create( Object object1, Object object2 )
> {
> Object[] result = create( 2 );
>
> @@ -176,7 +55,7 @@ public final class ObjectArrayPool
> return result;
> }
>
> - public synchronized Object[] create( Object object1, Object object2, Object object3 )
> + public Object[] create( Object object1, Object object2, Object object3 )
> {
> Object[] result = create( 3 );
>
> @@ -186,7 +65,7 @@ public final class ObjectArrayPool
> return result;
> }
>
> - public synchronized Object[] create( Object object1, Object object2, Object object3, Object object4 )
> + public Object[] create( Object object1, Object object2, Object object3, Object object4 )
> {
> Object[] result = create( 4 );
>
> @@ -197,7 +76,7 @@ public final class ObjectArrayPool
> return result;
> }
>
> - public synchronized Object[] create( Object object1, Object object2, Object object3, Object object4, Object object5 )
> + public Object[] create( Object object1, Object object2, Object object3, Object object4, Object object5 )
> {
> Object[] result = create( 5 );
>
> @@ -209,11 +88,11 @@ public final class ObjectArrayPool
> return result;
> }
>
> - public synchronized void recycle( Object[] value )
> + /**
> + * @deprecated object-pooling now relies on the jvm garbage collection
> + */
> + public void recycle( Object[] value )
> {
> - if ( value != null )
> - {
> - getSizePool( value.length ).recycle( value );
> - }
> + // no need of recycling, we rely on the garbage collection efficiency
> }
> }
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java Sun Oct 23 23:10:24 2011
> @@ -38,7 +38,7 @@ public class ObjectMethodAccessor
> * {@inheritDoc}
> */
> public Object callStaticMethod( Map<String, Object> context, Class<?> targetClass, String methodName, Object[] args )
> - throws MethodFailedException
> + throws OgnlException
> {
> List<Method> methods = OgnlRuntime.getMethods( targetClass, methodName, true );
>
> @@ -50,7 +50,7 @@ public class ObjectMethodAccessor
> * {@inheritDoc}
> */
> public Object callMethod( Map<String, Object> context, Object target, String methodName, Object[] args )
> - throws MethodFailedException
> + throws OgnlException
> {
> Class<?> targetClass = ( target == null ) ? null : target.getClass();
> List<Method> methods = OgnlRuntime.getMethods( targetClass, methodName, false );
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java Sun Oct 23 23:10:24 2011
> @@ -152,10 +152,9 @@ public class ObjectPropertyAccessor
> public Object getProperty( Map<String, Object> context, Object target, Object oname )
> throws OgnlException
> {
> - Object result = null;
> String name = oname.toString();
>
> - result = getPossibleProperty( context, target, name );
> + Object result = getPossibleProperty( context, target, name );
>
> if ( result == OgnlRuntime.NotFound )
> {
> @@ -262,7 +261,7 @@ public class ObjectPropertyAccessor
> }
>
> context.setCurrentType( m.getReturnType() );
> - context.setCurrentAccessor( OgnlRuntime.getCompiler( context ).getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
> + context.setCurrentAccessor( OgnlRuntime.getCompiler().getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
>
> return "." + m.getName() + "()";
>
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java Sun Oct 23 23:10:24 2011
> @@ -51,7 +51,7 @@ import java.util.Map;
> *<p>
> * This will parse the expression given and evaluate it against the root object given, returning the result. If there is
> * an error in the expression, such as the property is not found, the exception is encapsulated into an
> - * {@link ognl.OgnlException OgnlException}.
> + * {@link org.apache.commons.ognl.OgnlException OgnlException}.
> *</p>
> *<p>
> * Other more sophisticated uses of Ognl can pre-parse expressions. This provides two advantages: in the case of
> @@ -126,13 +126,13 @@ public abstract class Ognl
> }
>
> /**
> - * Parses and compiles the given expression using the {@link ognl.enhance.OgnlExpressionCompiler} returned from
> - * {@link ognl.OgnlRuntime#getCompiler()}.
> + * Parses and compiles the given expression using the {@link org.apache.commons.ognl.enhance.OgnlExpressionCompiler} returned from
> + * {@link org.apache.commons.ognl.OgnlRuntime#getCompiler()}.
> *
> * @param context The context to use.
> * @param root The root object for the given expression.
> * @param expression The expression to compile.
> - * @return The node with a compiled accessor set on {@link ognl.Node#getAccessor()} if compilation was successfull.
> + * @return The node with a compiled accessor set on {@link org.apache.commons.ognl.Node#getAccessor()} if compilation was successfull.
> * In instances where compilation wasn't possible because of a partially null expression the
> * {@link ExpressionAccessor} instance may be null and the compilation of this expression still possible at
> * some as yet indertermined point in the future.
> @@ -471,6 +471,7 @@ public abstract class Ognl
> * @return The value.
> */
> public static<T> T getValue( ExpressionAccessor expression, OgnlContext context, Object root, Class<T> resultType )
> + throws OgnlException
> {
> return getTypeConverter( context ).convertValue( context, root, null, null, expression.get( context, root ),
> resultType );
>
> Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlOps.java
> URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlOps.java?rev=1188000&r1=1187999&r2=1188000&view=diff
> ==============================================================================
> --- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlOps.java (original)
> +++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlOps.java Sun Oct 23 23:10:24 2011
> @@ -431,71 +431,85 @@ public abstract class OgnlOps
> }
>
> public static Object toArray( char value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( new Character( value ), toType );
> }
>
> public static Object toArray( byte value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( new Byte( value ), toType );
> }
>
> public static Object toArray( int value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( new Integer( value ), toType );
> }
>
> public static Object toArray( long value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( new Long( value ), toType );
> }
>
> public static Object toArray( float value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( new Float( value ), toType );
> }
>
> public static Object toArray( double value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( new Double( value ), toType );
> }
>
> public static Object toArray( boolean value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( Boolean.valueOf( value ), toType );
> }
>
> public static<T> Object convertValue( char value, Class<T> toType )
> + throws OgnlException
> {
> return convertValue( new Character( value ), toType );
> }
>
> public static<T> Object convertValue( byte value, Class<T> toType )
> + throws OgnlException
> {
> return convertValue( new Byte( value ), toType );
> }
>
> public static<T> Object convertValue( int value, Class<T> toType )
> + throws OgnlException
> {
> return convertValue( new Integer( value ), toType );
> }
>
> public static<T> Object convertValue( long value, Class<T> toType )
> + throws OgnlException
> {
> return convertValue( new Long( value ), toType );
> }
>
> public static<T> Object convertValue( float value, Class<T> toType )
> + throws OgnlException
> {
> return convertValue( new Float( value ), toType );
> }
>
> public static<T> Object convertValue( double value, Class<T> toType )
> + throws OgnlException
> {
> return convertValue( new Double( value ), toType );
> }
>
> public static<T> Object convertValue( boolean value, Class<T> toType )
> + throws OgnlException
> {
> return convertValue( Boolean.valueOf( value ), toType );
> }
> @@ -503,36 +517,43 @@ public abstract class OgnlOps
> // //////////////////////////////////////////////////////////////
>
> public static<T> Object convertValue( char value, Class<T> toType, boolean preventNull )
> + throws OgnlException
> {
> return convertValue( new Character( value ), toType, preventNull );
> }
>
> public static<T> Object convertValue( byte value, Class<T> toType, boolean preventNull )
> + throws OgnlException
> {
> return convertValue( new Byte( value ), toType, preventNull );
> }
>
> public static<T> Object convertValue( int value, Class<T> toType, boolean preventNull )
> + throws OgnlException
> {
> return convertValue( new Integer( value ), toType, preventNull );
> }
>
> public static<T> Object convertValue( long value, Class<T> toType, boolean preventNull )
> + throws OgnlException
> {
> return convertValue( new Long( value ), toType, preventNull );
> }
>
> public static<T> Object convertValue( float value, Class<T> toType, boolean preventNull )
> + throws OgnlException
> {
> return convertValue( new Float( value ), toType, preventNull );
> }
>
> public static<T> Object convertValue( double value, Class<T> toType, boolean preventNull )
> + throws OgnlException
> {
> return convertValue( new Double( value ), toType, preventNull );
> }
>
> public static<T> Object convertValue( boolean value, Class<T> toType, boolean preventNull )
> + throws OgnlException
> {
> return convertValue( Boolean.valueOf( value ), toType, preventNull );
> }
> @@ -540,36 +561,43 @@ public abstract class OgnlOps
> // ///////////////////////////////////////////////////////////////
>
> public static Object toArray( char value, Class<?> toType, boolean preventNull )
> + throws OgnlException
> {
> return toArray( new Character( value ), toType, preventNull );
> }
>
> public static Object toArray( byte value, Class<?> toType, boolean preventNull )
> + throws OgnlException
> {
> return toArray( new Byte( value ), toType, preventNull );
> }
>
> public static Object toArray( int value, Class<?> toType, boolean preventNull )
> + throws OgnlException
> {
> return toArray( new Integer( value ), toType, preventNull );
> }
>
> public static Object toArray( long value, Class<?> toType, boolean preventNull )
> + throws OgnlException
> {
> return toArray( new Long( value ), toType, preventNull );
> }
>
> public static Object toArray( float value, Class<?> toType, boolean preventNull )
> + throws OgnlException
> {
> return toArray( new Float( value ), toType, preventNull );
> }
>
> public static Object toArray( double value, Class<?> toType, boolean preventNull )
> + throws OgnlException
> {
> return toArray( new Double( value ), toType, preventNull );
> }
>
> public static Object toArray( boolean value, Class<?> toType, boolean preventNull )
> + throws OgnlException
> {
> return toArray( Boolean.valueOf( value ), toType, preventNull );
> }
> @@ -583,21 +611,24 @@ public abstract class OgnlOps
> * @return converted value of the type given, or value if the value cannot be converted to the given type.
> */
> public static Object convertValue( Object value, Class<?> toType )
> + throws OgnlException
> {
> return convertValue( value, toType, false );
> }
>
> public static Object toArray( Object value, Class<?> toType )
> + throws OgnlException
> {
> return toArray( value, toType, false );
> }
>
> public static Object toArray( Object value, Class<?> toType, boolean preventNulls )
> + throws OgnlException
> {
> if ( value == null )
> return null;
>
> - Object result = null;
> + Object result;
>
> if ( value.getClass().isArray()&& toType.isAssignableFrom( value.getClass().getComponentType() ) )
> {
> @@ -633,6 +664,7 @@ public abstract class OgnlOps
> }
>
> public static<T> Object convertValue( Object value, Class<T> toType, boolean preventNulls )
> + throws OgnlException
> {
> Object result = null;
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org