uk.org.skeet.jbench.tasks
Class ProxyTask

java.lang.Object
  |
  +--uk.org.skeet.jbench.tasks.SimpleTask
        |
        +--uk.org.skeet.jbench.tasks.ProxyTask
All Implemented Interfaces:
BenchTask, ProxyTaskInterface

public class ProxyTask
extends SimpleTask
implements ProxyTaskInterface

Task to determine the overhead of Proxy calls. A proxy to this instance is created in prepareTest, and used within runTest to increment and decrement a counter. (If useProxy is set to false, the normal instance is used instead, for comparison purposes.) A simple no-arg, no return value method is used so that no boxing/unboxing is needed.

Note - as Proxy is only available in 1.3.0, this task won't work with earlier JREs.


Constructor Summary
ProxyTask()
           
 
Method Summary
 void checkResults()
          Simple no-op implementation of checkResults.
 java.lang.String getDescription()
          Default description which gives the name of the actual class and the number of iterations.
 void incrementCounter()
          Increments the counter.
 void prepareTest()
          Simple no-op implementation of prepareTest.
 void runTest()
          Runs a test.
 void setUseProxy(boolean value)
          Sets whether or not to actually proxy.
 
Methods inherited from class uk.org.skeet.jbench.tasks.SimpleTask
checkConfiguration, getSize, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyTask

public ProxyTask()
Method Detail

setUseProxy

public void setUseProxy(boolean value)
Sets whether or not to actually proxy. Defaults to true.

runTest

public void runTest()
             throws TaskException
Description copied from interface: BenchTask
Runs a test. This is the method which is timed for result purposes. This should not include any preparation or result checking unless the time reported deliberately requires it.
See Also:
BenchTask.runTest()

incrementCounter

public void incrementCounter()
Increments the counter.
Specified by:
incrementCounter in interface ProxyTaskInterface

checkResults

public void checkResults()
                  throws TaskException
Description copied from class: SimpleTask
Simple no-op implementation of checkResults.
Overrides:
checkResults in class SimpleTask
See Also:
SimpleTask.checkResults()

prepareTest

public void prepareTest()
                 throws TaskException
Description copied from class: SimpleTask
Simple no-op implementation of prepareTest.
Overrides:
prepareTest in class SimpleTask
See Also:
SimpleTask.prepareTest()

getDescription

public java.lang.String getDescription()
Description copied from class: SimpleTask
Default description which gives the name of the actual class and the number of iterations.
Overrides:
getDescription in class SimpleTask
See Also:
SimpleTask.getDescription()