public Object invoke(Invocation invocation) throws Throwable { Method method = ((MethodInvocation) invocation).getMethod(); TransactionRetry txRetry = getAnnotation(invocation, method, TransactionRetry.class); int numRetries = txRetry.numRetries(); long waitTime = TimeUnit.MILLISECONDS.convert(txRetry.waitTime(), txRetry.waitTimeUnit()); while(true) { try { return invocation.invokeNext(); } catch(EJBTransactionRolledbackException e) { Thread.sleep(waitTime); if(--numRetries <= 0) throw e; } } } }