@Test void testRetryContextIsNotAvailable() throws Throwable { ProxyMethodInvocation methodInvocation = mock(ProxyMethodInvocation.class); when(methodInvocation.invocableClone()).thenReturn(methodInvocation); when(methodInvocation.proceed()).then(invocation -> { assertThat(RetrySynchronizationManager.getContext()).isNotNull(); return "foo"; }); RdbmsRetryOperationsInterceptor interceptor = new RdbmsRetryOperationsInterceptor(); interceptor.setLabel("mylabel"); interceptor.invoke(methodInvocation); verify(methodInvocation, times(1)).invocableClone(); }
@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);  }