@Override protected RetryStrategy getRetryStrategy() { // retry with no time limit return RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS); } }
@Override protected RetryStrategy getRetryStrategy() { // retry with no time limit return RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS); } }
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; }
@Override protected RetryStrategy getRetryStrategy() { // retry with no time limit return RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS); } }
@Override protected RetryStrategy getRetryStrategy() { // retry with no time limit return RetryStrategies.exponentialDelay(200, 10000, TimeUnit.MILLISECONDS); } }
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 RunCountUpgradeService(DefaultStore defaultStore) { super(RetryStrategies.exponentialDelay(1, 60, TimeUnit.SECONDS)); this.defaultStore = defaultStore; }
@Inject RunCountUpgradeService(DefaultStore defaultStore) { super(RetryStrategies.exponentialDelay(1, 60, TimeUnit.SECONDS)); this.defaultStore = defaultStore; }
/** * @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)); } }
/** * @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)); } }
public AdminEventPublisher(CConfiguration cConf, MessagingContext messagingContext) { this.topic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)); this.retryStrategy = RetryStrategies.timeLimit( 20, TimeUnit.SECONDS, RetryStrategies.exponentialDelay(10, 200, TimeUnit.MILLISECONDS)); this.messagingContext = messagingContext; }
@Override protected void startUp() throws Exception { final DatasetId serviceStoreDatasetInstanceId = NamespaceId.SYSTEM.dataset(Constants.Service.SERVICE_INSTANCE_TABLE_NAME); table = Retries.supplyWithRetries(() -> { try { return DatasetsUtil.getOrCreateDataset(dsFramework, serviceStoreDatasetInstanceId, NoTxKeyValueTable.class.getName(), DatasetProperties.EMPTY, null); } catch (Exception e) { // Throwing RetryableException here is just to make it retry getting the dataset // an exception here usually means there is an hbase problem LOG.warn("Error getting service store dataset {}. Will retry after some time: {}", serviceStoreDatasetInstanceId, e.getMessage()); throw new RetryableException(e); } }, RetryStrategies.exponentialDelay(1, 30, TimeUnit.SECONDS)); }
@Inject DefaultAuditPublisher(CConfiguration cConf, MessagingService messagingService) { this.messagingService = messagingService; this.auditTopic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Audit.TOPIC)); this.retryStrategy = RetryStrategies.timeLimit( cConf.getLong(Constants.Audit.PUBLISH_TIMEOUT_MS), TimeUnit.MILLISECONDS, RetryStrategies.exponentialDelay(10, 200, TimeUnit.MILLISECONDS)); }
@Override protected void startUp() throws Exception { final DatasetId serviceStoreDatasetInstanceId = NamespaceId.SYSTEM.dataset(Constants.Service.SERVICE_INSTANCE_TABLE_NAME); table = Retries.supplyWithRetries(() -> { try { return DatasetsUtil.getOrCreateDataset(dsFramework, serviceStoreDatasetInstanceId, NoTxKeyValueTable.class.getName(), DatasetProperties.EMPTY, null); } catch (Exception e) { // Throwing RetryableException here is just to make it retry getting the dataset // an exception here usually means there is an hbase problem LOG.warn("Error getting service store dataset {}. Will retry after some time: {}", serviceStoreDatasetInstanceId, e.getMessage()); throw new RetryableException(e); } }, RetryStrategies.exponentialDelay(1, 30, TimeUnit.SECONDS)); }
@Inject DefaultAuditPublisher(CConfiguration cConf, MessagingService messagingService) { this.messagingService = messagingService; this.auditTopic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Audit.TOPIC)); this.retryStrategy = RetryStrategies.timeLimit( cConf.getLong(Constants.Audit.PUBLISH_TIMEOUT_MS), TimeUnit.MILLISECONDS, RetryStrategies.exponentialDelay(10, 200, TimeUnit.MILLISECONDS)); }
public AdminEventPublisher(CConfiguration cConf, MessagingContext messagingContext) { this.topic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Metadata.MESSAGING_TOPIC)); this.retryStrategy = RetryStrategies.timeLimit( 20, TimeUnit.SECONDS, RetryStrategies.exponentialDelay(10, 200, TimeUnit.MILLISECONDS)); this.messagingContext = messagingContext; }
/** * Persists running state to the {@link RemoteRuntimeDataset}. */ private void persistRunningState(ProgramRunId programRunId, ProgramOptions programOptions) { // Only retry for a max of 5 seconds. If it still failed to persist, it will fail to launch the program. RetryStrategy retryStrategy = RetryStrategies.timeLimit(5L, TimeUnit.SECONDS, RetryStrategies.exponentialDelay(100L, 1000L, TimeUnit.MILLISECONDS)); Retries.runWithRetries(() -> Transactionals.execute(transactional, context -> { RemoteRuntimeDataset dataset = RemoteRuntimeDataset.create(context, datasetFramework); dataset.write(programRunId, programOptions); }, RetryableException.class), retryStrategy); }
/** * Persists running state to the {@link RemoteRuntimeDataset}. */ private void persistRunningState(ProgramRunId programRunId, ProgramOptions programOptions) { // Only retry for a max of 5 seconds. If it still failed to persist, it will fail to launch the program. RetryStrategy retryStrategy = RetryStrategies.timeLimit(5L, TimeUnit.SECONDS, RetryStrategies.exponentialDelay(100L, 1000L, TimeUnit.MILLISECONDS)); Retries.runWithRetries(() -> Transactionals.execute(transactional, context -> { RemoteRuntimeDataset dataset = RemoteRuntimeDataset.create(context, datasetFramework); dataset.write(programRunId, programOptions); }, RetryableException.class), retryStrategy); }
MetadataMigrator(CConfiguration cConf, DatasetFramework dsFramework, TransactionSystemClient txClient) { // exponentially retry in case of failure to migrate super(RetryStrategies.exponentialDelay(1, 60, TimeUnit.SECONDS)); this.dsFramework = dsFramework; this.batchSize = cConf.getInt(Constants.Metadata.MIGRATOR_BATCH_SIZE); this.transactional = Transactions.createTransactionalWithRetry( Transactions.createTransactional(new MultiThreadDatasetCache(new SystemDatasetInstantiator(dsFramework), txClient, NamespaceId.SYSTEM, Collections.emptyMap(), null, null)), org.apache.tephra.RetryStrategies.retryOnConflict(20, 100) ); datasetIds.add(new KeyValue<>(NamespaceId.SYSTEM.dataset("system.metadata"), NamespaceId.SYSTEM.dataset("v2.system"))); datasetIds.add(new KeyValue<>(NamespaceId.SYSTEM.dataset("business.metadata"), NamespaceId.SYSTEM.dataset("v2.business"))); }
private String updateKafkaBrokerList(CConfiguration cConf, BrokerService brokerService) { String brokerList = Retries.callWithRetries( brokerService::getBrokerList, RetryStrategies.timeLimit(10, TimeUnit.SECONDS, RetryStrategies.exponentialDelay(100, 2000, TimeUnit.MILLISECONDS)) ); for (String param : kafkaBrokerListParams) { cConf.set(param, brokerList); } return brokerList; }