Example usage for org.springframework.aop.framework ReflectiveMethodInvocation invocableClone

List of usage examples for org.springframework.aop.framework ReflectiveMethodInvocation invocableClone

Introduction

In this page you can find the example usage for org.springframework.aop.framework ReflectiveMethodInvocation invocableClone.

Prototype

@Override
public MethodInvocation invocableClone() 

Source Link

Document

This implementation returns a shallow copy of this invocation object, including an independent copy of the original arguments array.

Usage

From source file:net.chrisrichardson.foodToGo.util.spring.TransactionRetryInterceptor.java

public Object invoke(MethodInvocation invocation) throws Throwable {
    int retryCount = 0;
    while (true)/* w  w  w  . j av a2  s .  co  m*/
        try {
            ReflectiveMethodInvocation inv = (ReflectiveMethodInvocation) invocation;
            MethodInvocation anotherInvocation = inv.invocableClone();
            return anotherInvocation.proceed();
        } catch (ConcurrencyFailureException e) {
            if (retryCount++ > maxRetryCount)
                throw e;
            else {
                cleanupBeforeRetrying();
                continue;
            }
        }
}