@Test(expected = FailsafeException.class) public void shouldRetryOn503() throws Exception { testee = spy(testee); doThrow(new IndexerAccessException("503")).when(testee).getAndStoreResultToDatabase(uriCaptor.capture(), any(), any()); testee.getAndStoreResultToDatabase(null, IndexerApiAccessType.NFO); }
@Override protected String getAndStoreResultToDatabase(URI uri, IndexerApiAccessType apiAccessType) throws IndexerAccessException { return Failsafe.with(retry503policy) .onFailedAttempt(throwable -> logger.warn("Encountered 503 error. Will retry")) .get(() -> getAndStoreResultToDatabase(uri, String.class, apiAccessType)); }
Binsearch extends Indexer<String> { @Override protected String getAndStoreResultToDatabase(URI uri, IndexerApiAccessType apiAccessType) throws IndexerAccessException { return Failsafe.with(retry503policy) .onFailedAttempt(throwable -> logger.warn("Encountered 503 error. Will retry")) .get(() -> getAndStoreResultToDatabase(uri, String.class, apiAccessType)); } }
Binsearch extends Indexer<String> { @Override protected String getAndStoreResultToDatabase(URI uri, IndexerApiAccessType apiAccessType) throws IndexerAccessException { return Failsafe.with(retry503policy) .onFailedAttempt(throwable -> logger.warn("Encountered 503 error. Will retry")) .get(() -> getAndStoreResultToDatabase(uri, String.class, apiAccessType)); }  }
Binsearch extends Indexer<String> { @Override protected String getAndStoreResultToDatabase(URI uri, IndexerApiAccessType apiAccessType) throws IndexerAccessException { return Failsafe.with(retry503policy) .onFailedAttempt(throwable -> logger.warn("Encountered 503 error. Will retry")) .get(() -> getAndStoreResultToDatabase(uri, String.class, apiAccessType)); }  @Override NfoResult getNfo(String guid); }
Binsearch extends Indexer<String> { @Override protected String getAndStoreResultToDatabase(URI uri, IndexerApiAccessType apiAccessType) throws IndexerAccessException { return Failsafe.with(retry503policy) .onFailedAttempt(throwable -> logger.warn("Encountered 503 error. Will retry")) .get(() -> getAndStoreResultToDatabase(uri, String.class, apiAccessType)); }  @Override NfoResult getNfo(String guid);  }