org.springframework.retry.RetryException Java Examples
The following examples show how to use
org.springframework.retry.RetryException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoadBalancedRecoveryCallback.java From spring-cloud-commons with Apache License 2.0 | 6 votes |
@Override public T recover(RetryContext context) throws Exception { Throwable lastThrowable = context.getLastThrowable(); if (lastThrowable != null) { if (lastThrowable instanceof RetryableStatusCodeException) { RetryableStatusCodeException ex = (RetryableStatusCodeException) lastThrowable; return createResponse((R) ex.getResponse(), ex.getUri()); } else if (lastThrowable instanceof Exception) { throw (Exception) lastThrowable; } } throw new RetryException("Could not recover", lastThrowable); }
Example #2
Source File: InstanceInitializeServiceTest.java From api-layer with Eclipse Public License 2.0 | 5 votes |
@Test public void shouldThrowExceptionWhenCatalogNotFound() throws CannotRegisterServiceException { String catalogId = CoreService.API_CATALOG.getServiceId(); when(instanceRetrievalService.getInstanceInfo(catalogId)).thenReturn(null); exception.expect(CannotRegisterServiceException.class); exception.expectCause(isA(RetryException.class)); instanceInitializeService.retrieveAndRegisterAllInstancesWithCatalog(); }
Example #3
Source File: InstanceInitializeServiceTest.java From api-layer with Eclipse Public License 2.0 | 5 votes |
@Test public void shouldThrowRetryExceptionOnInstanceInitializationException() throws CannotRegisterServiceException { String catalogId = CoreService.API_CATALOG.getServiceId(); when(instanceRetrievalService.getInstanceInfo(catalogId)).thenThrow(new InstanceInitializationException("ERROR")); exception.expect(RetryException.class); exception.expectMessage("ERROR"); instanceInitializeService.retrieveAndRegisterAllInstancesWithCatalog(); }
Example #4
Source File: InstanceInitializeServiceTest.java From api-layer with Eclipse Public License 2.0 | 5 votes |
@Test public void shouldThrowRetryExceptionOnGatewayNotAvailableException() throws CannotRegisterServiceException { String catalogId = CoreService.API_CATALOG.getServiceId(); when(instanceRetrievalService.getInstanceInfo(catalogId)).thenThrow(new GatewayNotAvailableException("ERROR")); exception.expect(RetryException.class); exception.expectMessage("ERROR"); instanceInitializeService.retrieveAndRegisterAllInstancesWithCatalog(); }
Example #5
Source File: RdbmsRetryOperationsInterceptorTest.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@Test void testRetryContextWithoutTransaction() throws Throwable { TransactionSynchronizationManager.setActualTransactionActive(true); try { RdbmsRetryOperationsInterceptor operationsInterceptor = new RdbmsRetryOperationsInterceptor(); MethodInvocation methodInvocation = mock(MethodInvocation.class); assertThatThrownBy(() -> operationsInterceptor.invoke(methodInvocation)) .isInstanceOf(RetryException.class) .hasMessageContaining("An active transaction was found"); } finally { TransactionSynchronizationManager.setActualTransactionActive(false); } }
Example #6
Source File: InstanceInitializeService.java From api-layer with Eclipse Public License 2.0 | 4 votes |
@Recover public void recover(RetryException e) { apimlLog.log("org.zowe.apiml.apicatalog.initializeFailed"); }