}
public void testConcurrentDeletionWithoutTx() throws Exception
{
final String slowThreadName = "SLOW";
Interceptor slowdownInterceptor = new Interceptor()
{
public Object invoke(MethodCall c) throws Throwable
{
if (Thread.currentThread().getName().equals(slowThreadName) &&
((JBCMethodCall) c).getMethodId() == MethodDeclarations.optimisticPrepareMethod_id)
{
Thread.sleep(1000);
}
return super.invoke(c);
}
};
List interceptors = cache.getInterceptors();
int i=0;
for (i=0; i<interceptors.size(); i++)
{
if (interceptors.get(i) instanceof TxInterceptor) break;
}
Interceptor prev = (Interceptor) interceptors.get(i);
Interceptor next = (Interceptor) interceptors.get(i+1);
slowdownInterceptor.setNext(next);
prev.setNext(slowdownInterceptor);
cache.setInterceptorChain((Interceptor) interceptors.get(0));