org.objectweb.jac.aspects.tracing
Class OptimizedCountingWrapper
java.lang.Object
org.objectweb.jac.core.Wrapper
org.objectweb.jac.aspects.tracing.SimpleCountingWrapper
org.objectweb.jac.aspects.tracing.OptimizedCountingWrapper
- All Implemented Interfaces:
- Advice, ConstructorInterceptor, Interceptor, MethodInterceptor, Serializable
- public class OptimizedCountingWrapper
- extends SimpleCountingWrapper
This counter must wrap the methods of which calls have to be
counted. It extends the simple counting wrapper to provide 2
optimization methods when client methods call several times the
method wrapped by incr
. In these cases, the counter is
direcly incremented by the number of times the incr
method has to be called.
In order to avoid redundancy, incr
must not be
called if incrWithArg
or incrWithField
have already been called. To perform this contextual test, use the
before and after running wrapper methods of the aspect
component.
- See Also:
- Serialized Form
Fields inherited from class org.objectweb.jac.core.Wrapper |
ac, cr |
OptimizedCountingWrapper
public OptimizedCountingWrapper(AspectComponent ac,
Counter c,
String field)
- Create the counter and parametrize it regarding the base program
shape.
- Parameters:
c
- the used counterfield
- the field that is used to optimize the counting
OptimizedCountingWrapper
public OptimizedCountingWrapper(AspectComponent ac,
Counter c,
int arg)
- Create the counter and parametrize it regarding the base program
shape.
- Parameters:
c
- the used counterarg
- the argument number that used to optimize the
counting
incrWithField
public Object incrWithField(Interaction interaction)
- This wrapping method increments the counter with the field when
the wrapped method is called. It is an optimization for the incr
method.
- Returns:
- the return value of the wrapped method
- See Also:
SimpleCountingWrapper.incr(Interaction)
incrWithArg
public Object incrWithArg(Interaction interaction)
- This wrapping method increments the counter with the argument
value when the wrapped method is called. It is an optimization
for the
incr
method.
- Returns:
- the return value of the wrapped method
- See Also:
SimpleCountingWrapper.incr(Interaction)
invoke
public Object invoke(MethodInvocation invocation)
throws Throwable
- Specified by:
invoke
in interface MethodInterceptor
- Overrides:
invoke
in class SimpleCountingWrapper
- Throws:
Throwable
construct
public Object construct(ConstructorInvocation invocation)
throws Throwable
- Specified by:
construct
in interface ConstructorInterceptor
- Overrides:
construct
in class SimpleCountingWrapper
- Throws:
Throwable