@Test void testRetryContextIsAvailable() throws Throwable { RetryContext retryContext = mock(RetryContext.class); RetrySynchronizationManager.register(retryContext); MethodInvocation methodInvocation = mock(MethodInvocation.class); try { RdbmsRetryOperationsInterceptor interceptor = new RdbmsRetryOperationsInterceptor(); interceptor.invoke(methodInvocation); } finally { RetrySynchronizationManager.clear(); } verify(methodInvocation, times(1)).proceed(); }
@Override public Object invoke(MethodInvocation invocation) throws Throwable { Object result; if (!isRetryContextOperationActive()) { assertNoTransactionActive(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Starting a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } result = super.invoke(invocation); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Finished a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } } else { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Participating in existing retry operation"); } result = invocation.proceed(); } return result; }
RdbmsRetryOperationsInterceptor extends RetryOperationsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { Object result; if (!isRetryContextOperationActive()) { assertNoTransactionActive(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Starting a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } result = super.invoke(invocation); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Finished a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } } else { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Participating in existing retry operation"); } result = invocation.proceed(); } return result; } }
RdbmsRetryOperationsInterceptor extends RetryOperationsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { Object result; if (!isRetryContextOperationActive()) { assertNoTransactionActive(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Starting a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } result = super.invoke(invocation); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Finished a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } } else { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Participating in existing retry operation"); } result = invocation.proceed(); } return result; }  }
RdbmsRetryOperationsInterceptor extends RetryOperationsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { Object result; if (!isRetryContextOperationActive()) { assertNoTransactionActive(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Starting a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } result = super.invoke(invocation); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Finished a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } } else { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Participating in existing retry operation"); } result = invocation.proceed(); } return result; }  @Override Object invoke(MethodInvocation invocation); }
RdbmsRetryOperationsInterceptor extends RetryOperationsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { Object result; if (!isRetryContextOperationActive()) { assertNoTransactionActive(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Starting a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } result = super.invoke(invocation); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Finished a new Retry Interceptor for {}", (invocation != null ? invocation.getMethod() : null)); } } else { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Participating in existing retry operation"); } result = invocation.proceed(); } return result; }  @Override Object invoke(MethodInvocation invocation);  }