net.sf.tie.ext.interceptor
Class SynchronizedInterceptor

java.lang.Object
  extended by net.sf.tie.ext.interceptor.SynchronizedInterceptor
All Implemented Interfaces:
Advice, Interceptor, MethodInterceptor

public class SynchronizedInterceptor
extends Object
implements MethodInterceptor

The SynchronizedInterceptor applies a synchronization block (using a provided "lock" object) around each method invocation. It the provided lock is null, then the end-point of the invocation is used instead.


Constructor Summary
SynchronizedInterceptor(Object lock)
           
 
Method Summary
 Object invoke(MethodInvocation invocation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedInterceptor

public SynchronizedInterceptor(Object lock)
Parameters:
lock - The object to synchronize around. May be null in which case the result of Joinpoint.getThis() is used for each call.
Method Detail

invoke

public Object invoke(MethodInvocation invocation)
              throws Throwable
Specified by:
invoke in interface MethodInterceptor
Throws:
Throwable