/** * @return the retry strategy to use when executing this bootstrap step */ protected RetryStrategy getRetryStrategy() { // exponential retries with a time limit of 5 minutes. return RetryStrategies.timeLimit(5, TimeUnit.MINUTES, RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS)); } }
/** * Creates an instance without messaging admin support. */ public DefaultAdmin(DatasetFramework dsFramework, NamespaceId namespace, SecureStoreManager secureStoreManager, NamespaceQueryAdmin namespaceQueryAdmin) { this(dsFramework, namespace, secureStoreManager, null, RetryStrategies.noRetry(), null, namespaceQueryAdmin); }
@Inject RemotePluginFinder(CConfiguration cConf, DiscoveryServiceClient discoveryServiceClient, AuthenticationContext authenticationContext, LocationFactory locationFactory) { this.remoteClient = new RemoteClient(discoveryServiceClient, Constants.Service.APP_FABRIC_HTTP, new DefaultHttpRequestConfig(false), String.format("%s", Constants.Gateway.API_VERSION_3)); this.authorizationEnabled = cConf.getBoolean(Constants.Security.Authorization.ENABLED); this.authenticationContext = authenticationContext; this.locationFactory = locationFactory; this.retryStrategy = RetryStrategies.limit(30, RetryStrategies.fixDelay(2, TimeUnit.SECONDS)); }
return RetryStrategies.noRetry(); switch (type) { case FIXED_DELAY: baseStrategy = RetryStrategies.fixDelay(baseDelay, TimeUnit.MILLISECONDS); break; case EXPONENTIAL_BACKOFF: long maxDelay = cConf.getLong(maxDelayKey); baseStrategy = RetryStrategies.exponentialDelay(baseDelay, maxDelay, TimeUnit.MILLISECONDS); break; default: return RetryStrategies.limit(maxRetries, RetryStrategies.timeLimit(maxTimeSecs, TimeUnit.SECONDS, baseStrategy));
@Override public int waitFor() throws InterruptedException { RetryStrategy retry = RetryStrategies.fixDelay(100, TimeUnit.MILLISECONDS); return Retries.supplyWithRetries(this::exitValue, retry, IllegalThreadStateException.class::isInstance); }
ConstraintCheckerThread(int partition) { // TODO: [CDAP-11370] Need to be configured in cdap-default.xml. Retry with delay ranging from 0.1s to 30s scheduleStrategy = co.cask.cdap.common.service.RetryStrategies.exponentialDelay(100, 30000, TimeUnit.MILLISECONDS); this.partition = partition; }
@Inject MessagingMetadataPublisher(CConfiguration cConf, MessagingService messagingService) { this.topic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)); this.messagingService = messagingService; this.retryStrategy = RetryStrategies.fromConfiguration(cConf, "system.metadata."); }
LOG.debug("Starting {} task for program run {}.", initialTaskInfo.getProvisioningOp().getType(), programRunId); RetryStrategy retryStrategy = RetryStrategies.statefulTimeLimit(retryTimeLimitSecs, TimeUnit.SECONDS, System.currentTimeMillis(), RetryStrategies.exponentialDelay(100, 20000, TimeUnit.MILLISECONDS)); Map<ProvisioningOp.Status, ProvisioningSubtask> subtasks = getSubtasks();
return RetryStrategies.noRetry(); switch (type) { case FIXED_DELAY: baseStrategy = RetryStrategies.fixDelay(baseDelay, TimeUnit.MILLISECONDS); break; case EXPONENTIAL_BACKOFF: long maxDelay = cConf.getLong(maxDelayKey); baseStrategy = RetryStrategies.exponentialDelay(baseDelay, maxDelay, TimeUnit.MILLISECONDS); break; default: return RetryStrategies.limit(maxRetries, RetryStrategies.timeLimit(maxTimeSecs, TimeUnit.SECONDS, baseStrategy));
@Override public int waitFor() throws InterruptedException { RetryStrategy retry = RetryStrategies.fixDelay(100, TimeUnit.MILLISECONDS); return Retries.supplyWithRetries(this::exitValue, retry, IllegalThreadStateException.class::isInstance); }
@Override protected RetryStrategy getRetryStrategy() { // retry with no time limit return RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS); } }
@Inject MessagingLineageWriter(CConfiguration cConf, MessagingService messagingService) { this.topic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)); this.messagingService = messagingService; this.retryStrategy = RetryStrategies.fromConfiguration(cConf, "system.metadata."); }
@Inject RemotePluginFinder(CConfiguration cConf, DiscoveryServiceClient discoveryServiceClient, AuthenticationContext authenticationContext, LocationFactory locationFactory) { this.remoteClient = new RemoteClient(discoveryServiceClient, Constants.Service.APP_FABRIC_HTTP, new DefaultHttpRequestConfig(false), String.format("%s", Constants.Gateway.API_VERSION_3)); this.authorizationEnabled = cConf.getBoolean(Constants.Security.Authorization.ENABLED); this.authenticationContext = authenticationContext; this.locationFactory = locationFactory; this.retryStrategy = RetryStrategies.limit(30, RetryStrategies.fixDelay(2, TimeUnit.SECONDS)); }
LOG.debug("Starting {} task for program run {}.", initialTaskInfo.getProvisioningOp().getType(), programRunId); RetryStrategy retryStrategy = RetryStrategies.statefulTimeLimit(retryTimeLimitSecs, TimeUnit.SECONDS, System.currentTimeMillis(), RetryStrategies.exponentialDelay(100, 20000, TimeUnit.MILLISECONDS)); Map<ProvisioningOp.Status, ProvisioningSubtask> subtasks = getSubtasks();
/** * @return the retry strategy to use when executing this bootstrap step */ protected RetryStrategy getRetryStrategy() { // exponential retries with a time limit of 5 minutes. return RetryStrategies.timeLimit(5, TimeUnit.MINUTES, RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS)); } }
/** * delete dataset instance with retry if dataset service is not available. returns true if deletion is successful * @throws Exception; we throw interrupted exception when we are stopping */ static Void deleteInstanceWithRetry(final DatasetFramework datasetFramework, final DatasetId datasetId) throws Exception { return Retries.callWithRetries(new Retries.Callable<Void, Exception>() { @Override public Void call() throws Exception { if (!stopping) { datasetFramework.deleteInstance(datasetId); return null; } else { throw new InterruptedException( String.format("Giving up delete dataset retry for %s, as we are stopping", datasetId.getDataset())); } } }, RetryStrategies.fixDelay(1, TimeUnit.SECONDS)); }
@Override protected RetryStrategy getRetryStrategy() { // retry with no time limit return RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS); } }
@Inject ProvisionerNotifier(CConfiguration cConf, MessagingService messagingService) { this.topic = NamespaceId.SYSTEM.topic(cConf.get(Constants.AppFabric.PROGRAM_STATUS_EVENT_TOPIC)); this.retryStrategy = RetryStrategies.fromConfiguration(cConf, "system.program.state."); this.messagingService = messagingService; }