org.apache.sirona.aop
Class AbstractPerformanceInterceptor<T>

java.lang.Object
  extended by org.apache.sirona.aop.AbstractPerformanceInterceptor<T>
All Implemented Interfaces:
Serializable

public abstract class AbstractPerformanceInterceptor<T>
extends Object
implements Serializable

A method interceptor that compute method invocation performances.

Concrete implementation will adapt the method interception API to this class requirement.

Author:
Nicolas De Loof
See Also:
Serialized Form

Nested Class Summary
protected static class AbstractPerformanceInterceptor.ActivationContext
          This class contains the activation/deactivation logic.
static class AbstractPerformanceInterceptor.Context
          The handler for cases where interception is not possible and you need to pass the "before"object to be able to monitor.
protected static class AbstractPerformanceInterceptor.SerializableMethod
           
 
Field Summary
protected static ConcurrentMap<Object,AbstractPerformanceInterceptor.ActivationContext> CONTEXTS
           
protected  MonitorNameExtractor monitorNameExtractor
           
 
Constructor Summary
AbstractPerformanceInterceptor()
           
 
Method Summary
protected  AbstractPerformanceInterceptor.Context before(T invocation, String name)
           
protected  AbstractPerformanceInterceptor.ActivationContext doFindContext(T invocation)
           
protected  Object doInvoke(T invocation)
          API neutral method invocation
protected  Object extractContextKey(T invocation)
           
protected  String getCounterName(Object instance, Method method)
          Compute the counter name associated to this method invocation
protected abstract  String getCounterName(T invocation)
           
protected  Counter.Key getKey(T invocation, String name)
           
protected  AbstractPerformanceInterceptor.ActivationContext getOrCreateContext(Object m)
           
protected  Role getRole()
           
protected  boolean isAdaptive()
           
protected  AbstractPerformanceInterceptor.Context newContext(T invocation, AbstractPerformanceInterceptor.ActivationContext context, StopWatch stopwatch)
           
protected abstract  Object proceed(T invocation)
           
protected  AbstractPerformanceInterceptor.ActivationContext putAndGetActivationContext(Object m, AbstractPerformanceInterceptor.ActivationContext newCtx)
           
 void setMonitorNameExtractor(MonitorNameExtractor monitorNameExtractor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXTS

protected static final ConcurrentMap<Object,AbstractPerformanceInterceptor.ActivationContext> CONTEXTS

monitorNameExtractor

protected MonitorNameExtractor monitorNameExtractor
Constructor Detail

AbstractPerformanceInterceptor

public AbstractPerformanceInterceptor()
Method Detail

doInvoke

protected Object doInvoke(T invocation)
                   throws Throwable
API neutral method invocation

Throws:
Throwable

before

protected AbstractPerformanceInterceptor.Context before(T invocation,
                                                        String name)

newContext

protected AbstractPerformanceInterceptor.Context newContext(T invocation,
                                                            AbstractPerformanceInterceptor.ActivationContext context,
                                                            StopWatch stopwatch)

getKey

protected Counter.Key getKey(T invocation,
                             String name)

isAdaptive

protected boolean isAdaptive()

extractContextKey

protected Object extractContextKey(T invocation)

getOrCreateContext

protected AbstractPerformanceInterceptor.ActivationContext getOrCreateContext(Object m)

putAndGetActivationContext

protected AbstractPerformanceInterceptor.ActivationContext putAndGetActivationContext(Object m,
                                                                                      AbstractPerformanceInterceptor.ActivationContext newCtx)

doFindContext

protected AbstractPerformanceInterceptor.ActivationContext doFindContext(T invocation)

getRole

protected Role getRole()

proceed

protected abstract Object proceed(T invocation)
                           throws Throwable
Throws:
Throwable

getCounterName

protected abstract String getCounterName(T invocation)

getCounterName

protected String getCounterName(Object instance,
                                Method method)
Compute the counter name associated to this method invocation

Parameters:
method - method being invoked
Returns:
counter name. If null, nothing will be monitored

setMonitorNameExtractor

public void setMonitorNameExtractor(MonitorNameExtractor monitorNameExtractor)


Copyright © 2008–2013 The Apache Software Foundation. All rights reserved.