org.apache.commons.jexl2
Class CacheTest.Task

java.lang.Object
  extended by org.apache.commons.jexl2.CacheTest.Task
All Implemented Interfaces:
Callable<Integer>
Direct Known Subclasses:
CacheTest.AssignBooleanTask, CacheTest.AssignListTask, CacheTest.AssignNullTask, CacheTest.AssignTask, CacheTest.ComputeTask
Enclosing class:
CacheTest

public abstract static class CacheTest.Task
extends Object
implements Callable<Integer>

The base class for MT tests.


Method Summary
abstract  Integer call()
           
 Integer runAssign(Object value)
          The actual test function; assigns and checks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

call

public abstract Integer call()
                      throws Exception
Specified by:
call in interface Callable<Integer>
Throws:
Exception

runAssign

public Integer runAssign(Object value)
The actual test function; assigns and checks.

The expression will be evaluated against different classes in parallel. This verifies that neither the volatile cache in the AST nor the expression cache in the JEXL engine induce errors.

Using it as a micro benchmark, it shows creating expression as the dominating cost; the expression cache takes care of this. By moving the expression creations out of the main loop, it also shows that the volatile cache speeds things up around 2x.

Parameters:
value - the argument value to control
Returns:
the number of loops performed


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.