private void stopKafkaIngestion(String overlordAddress, String dataSourceName) { try { FullResponseHolder response = RetryUtils.retry(() -> DruidStorageHandlerUtils.getResponseFromCurrentLeader(getHttpClient(), new Request(HttpMethod.POST, new URL(String.format("http://%s/druid/indexer/v1/supervisor/%s/shutdown", overlordAddress, dataSourceName))), new FullResponseHandler(Charset.forName("UTF-8"))), input -> input instanceof IOException, getMaxRetryCount()); if (response.getStatus().equals(HttpResponseStatus.OK)) { CONSOLE.printInfo("Druid Kafka Ingestion shutdown successful."); } else { throw new IOException(String.format("Unable to stop Kafka Ingestion Druid status [%d] full response [%s]", response.getStatus().getCode(), response.getContent())); } } catch (Exception e) { throw new RuntimeException(e); } }
private void resetKafkaIngestion(String overlordAddress, String dataSourceName) { try { FullResponseHolder response = RetryUtils.retry(() -> DruidStorageHandlerUtils.getResponseFromCurrentLeader(getHttpClient(), new Request(HttpMethod.POST, new URL(String.format("http://%s/druid/indexer/v1/supervisor/%s/reset", overlordAddress, dataSourceName))), new FullResponseHandler(Charset.forName("UTF-8"))), input -> input instanceof IOException, getMaxRetryCount()); if (response.getStatus().equals(HttpResponseStatus.OK)) { CONSOLE.printInfo("Druid Kafka Ingestion Reset successful."); } else { throw new IOException(String.format("Unable to reset Kafka Ingestion Druid status [%d] full response [%s]", response.getStatus().getCode(), response.getContent())); } } catch (Exception e) { throw new RuntimeException(e); } }
try { coordinatorResponse = RetryUtils.retry(() -> DruidStorageHandlerUtils.getResponseFromCurrentLeader(getHttpClient(), new Request(HttpMethod.GET, new URL(String.format("http://%s/status", coordinatorAddress))), new FullResponseHandler(Charset.forName("UTF-8"))).getContent(),
FullResponseHolder response = RetryUtils.retry(() -> DruidStorageHandlerUtils.getResponseFromCurrentLeader(getHttpClient(), new Request(HttpMethod.GET, new URL(String.format("http://%s/druid/indexer/v1/supervisor/%s", overlordAddress, dataSourceName))),
FullResponseHolder response = RetryUtils.retry(() -> DruidStorageHandlerUtils.getResponseFromCurrentLeader(getHttpClient(), new Request(HttpMethod.GET, new URL(String.format("http://%s/druid/indexer/v1/supervisor/%s/status",
/** * Same as {@link #retry(Callable, Predicate, int, int)} with quietTries = 0. */ public static <T> T retry(final Callable<T> f, Predicate<Throwable> shouldRetry, final int maxTries) throws Exception { return retry(f, shouldRetry, 0, maxTries); }
/** * Retries S3 operations that fail due to io-related exceptions. Service-level exceptions (access denied, file not * found, etc) are not retried. */ public static <T> T retryS3Operation(Callable<T> f) throws Exception { final int maxTries = 10; return RetryUtils.retry(f, S3RETRY, maxTries); }
public <T> T retryTransaction(final TransactionCallback<T> callback, final int quietTries, final int maxTries) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().inTransaction(callback); } }; try { return RetryUtils.retry(call, shouldRetry, quietTries, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }
public <T> T retryWithHandle( final HandleCallback<T> callback, final Predicate<Throwable> myShouldRetry ) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().withHandle(callback); } }; try { return RetryUtils.retry(call, myShouldRetry, DEFAULT_MAX_TRIES); } catch (Exception e) { throw Throwables.propagate(e); } }
return RetryUtils.retry( new Callable<Long>()
public String submitTask(final String task) return RetryUtils.retry( new Callable<String>()
return RetryUtils.retry( new Callable<URI>()
if (jarFile.getName().endsWith(".jar")) { try { RetryUtils.retry( new Callable<Boolean>()
public static boolean deleteWithRetry(final FileSystem fs, final Path path, final boolean recursive) { try { return RetryUtils.retry( new Callable<Boolean>() { @Override public Boolean call() throws Exception { return fs.delete(path, recursive); } }, shouldRetryPredicate(), NUM_RETRIES ); } catch (Exception e) { log.error(e, "Failed to cleanup path[%s]", path); throw Throwables.propagate(e); } } }
private void deleteWithRetries(final String s3Bucket, final String s3Path) throws Exception { RetryUtils.retry( (Callable<Void>) () -> { try { s3Client.deleteObject(s3Bucket, s3Path); return null; } catch (Exception e) { log.info(e, "Error while trying to delete [s3://%s/%s]", s3Bucket, s3Path); throw e; } }, S3Utils.S3RETRY, 3 ); } }
return RetryUtils.retry( new Callable<FileUtils.FileCopyResult>()
RetryUtils.retry( new Callable<Void>()
@Nullable private Map<String, BasicAuthenticatorUser> fetchUserMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchUserMapFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user map for authenticator [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserMapFromDisk(prefix); } catch (Exception e2) { e2.addSuppressed(e); LOG.makeAlert(e2, "Encountered exception while loading user map snapshot for authenticator [%s]", prefix); } } } return null; } }
@Nullable private UserAndRoleMap fetchUserAndRoleMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchMapsFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user and role map for authorizer [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserAndRoleMapFromDisk(prefix); } catch (Exception e2) { e2.addSuppressed(e); LOG.makeAlert(e2, "Encountered exception while loading user-role map snapshot for authorizer [%s]", prefix); } } } return null; } }
RetryUtils.retry( () -> { if (!lookupExtractorFactoryContainer.getLookupExtractorFactory().start()) {