org.apache.cocoon.profiling.profiler
Class Profiler<T>

java.lang.Object
  extended by org.apache.cocoon.profiling.profiler.Profiler<T>
Direct Known Subclasses:
GenerateNodeProfiler, MatchNodeProfiler, PipelineComponentProfiler, PipelineNodeProfiler, PipelineProfiler, ServletProfiler, SitemapNodeProfiler, TransformNodeProfiler

public abstract class Profiler<T>
extends Object

Base class for all profiling data handlers. A new instance is created for each method invocation and the methods before and after/exception are called. It stores invocation time and end time of the invocation. Implementors of subclasses can provide methods annotated with ProfileMethod. Depending on the ProfileMethodType the method has to have a specific signature:

If in the ProfileMethod annotation no method name is specified, the profile method will be installed as default and called for all method invocations.


Field Summary
protected static org.slf4j.Logger LOG
          Logger.
 
Constructor Summary
Profiler(Class<? extends T> targetClass)
           
 
Method Summary
 void after(ProfilingData data, String methodName, Object returnValue)
          This method is called after the invocation was successfully finished.
 void before(ProfilingData data, Object target, String methodName, Object[] args)
          This method is called before the invocation takes place on the given target object.
 void exception(ProfilingData data, String methodName, Exception exception)
          This method is called after the invocation was successfully finished.
 Class<? extends T> getTargetClass()
           
 void setProfilingDataManager(ProfilingDataManager dataManager)
           
 void setProfilingIdGenerator(ProfilingIdGenerator idGenerator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.slf4j.Logger LOG
Logger.

Constructor Detail

Profiler

public Profiler(Class<? extends T> targetClass)
Parameters:
targetClass - class for which this profiler should be registered
Method Detail

after

public final void after(ProfilingData data,
                        String methodName,
                        Object returnValue)
This method is called after the invocation was successfully finished.

Parameters:
data - the ProfilingData object used to store the profiling information for this invocation.
methodName - the name of the method that was intercepted.
returnValue - the return value of the method that was intercepted

before

public final void before(ProfilingData data,
                         Object target,
                         String methodName,
                         Object[] args)
This method is called before the invocation takes place on the given target object.

Parameters:
data - the ProfilingData object used to store the profiling information for this invocation.
target - the object on which the intercepted invocation is performed.
methodName - the name of the method that has been intercepted.
args - the arguments of the intercepted method.

exception

public final void exception(ProfilingData data,
                            String methodName,
                            Exception exception)
This method is called after the invocation was successfully finished.

Parameters:
data - the ProfilingData object used to store the profiling information for this invocation.
methodName - the name of the method that was intercepted.
exception - the exception that was thrown by the method that was intercepted

getTargetClass

public final Class<? extends T> getTargetClass()
Returns:
The Class, whose instances will be profiled by this profiler.

setProfilingDataManager

public void setProfilingDataManager(ProfilingDataManager dataManager)

setProfilingIdGenerator

public void setProfilingIdGenerator(ProfilingIdGenerator idGenerator)


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.