use of net.jodah.failsafe.function.Predicate in project ddf by codice.
the class ContentProducerDataAccessObject method waitForAvailableSource.
private void waitForAvailableSource(CatalogFramework catalogFramework) throws SourceUnavailableException {
RetryPolicy retryPolicy = new RetryPolicy().withDelay(3, TimeUnit.SECONDS).withMaxDuration(3, TimeUnit.MINUTES).retryIf((Predicate<Set>) Set::isEmpty).retryIf((Set<SourceDescriptor> result) -> !result.stream().findFirst().get().isAvailable());
Failsafe.with(retryPolicy).get(() -> catalogFramework.getSourceInfo(new SourceInfoRequestLocal(false)).getSourceInfo());
}
Aggregations