com.github.rholder.retry.WaitStrategy Java Examples
The following examples show how to use
com.github.rholder.retry.WaitStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Authenticator.java From styx with Apache License 2.0 | 6 votes |
Authenticator(GoogleIdTokenVerifier googleIdTokenVerifier, CloudResourceManager cloudResourceManager, Iam iam, AuthenticatorConfiguration configuration, WaitStrategy retryWaitStrategy, StopStrategy retryStopStrategy) { this.googleIdTokenVerifier = Objects.requireNonNull(googleIdTokenVerifier, "googleIdTokenVerifier"); this.cloudResourceManager = Objects.requireNonNull(cloudResourceManager, "cloudResourceManager"); this.iam = Objects.requireNonNull(iam, "iam"); this.domainWhitelist = configuration.domainWhitelist(); this.resourceWhitelist = configuration.resourceWhitelist(); this.allowedAudiences = configuration.allowedAudiences(); this.retryWaitStrategy = Objects.requireNonNull(retryWaitStrategy, "retryWaitStrategy"); this.retryStopStrategy = Objects.requireNonNull(retryStopStrategy, "retryStopStrategy"); }
Example #2
Source File: BigtableStorage.java From styx with Apache License 2.0 | 6 votes |
@VisibleForTesting BigtableStorage(Connection connection, ExecutorService executor, WaitStrategy waitStrategy, StopStrategy retryStopStrategy) { this.connection = Objects.requireNonNull(connection, "connection"); this.executor = MDCUtil.withMDC(Context.currentContextExecutor( register(closer, Objects.requireNonNull(executor, "executor"), "bigtable-storage"))); retryer = RetryerBuilder.<Void>newBuilder() .retryIfExceptionOfType(IOException.class) .withWaitStrategy(Objects.requireNonNull(waitStrategy, "waitStrategy")) .withStopStrategy(Objects.requireNonNull(retryStopStrategy, "retryStopStrategy")) .withRetryListener(BigtableStorage::onRequestAttempt) .build(); }
Example #3
Source File: RetryUtil.java From cloudbreak with Apache License 2.0 | 6 votes |
/** * Builds a retryer. * * @param actionDescription a description of the action being performed * @param waitUntilTime the latest time to wait to perform the action * @param sleepTimeMs the sleep time in millisecond for retries * @param exceptionClass the class of exception to throw * @param logger the logger * @param <T> the type of object returned * @return the retryer */ private static <T> Retryer<T> buildRetryer(String actionDescription, ZonedDateTime waitUntilTime, long sleepTimeMs, Class<? extends CcmException> exceptionClass, Logger logger) { StopStrategy stop; if (waitUntilTime != null) { // Given the time at which waiting should stop, // get the available number of millis from this instant stop = StopStrategyFactory.waitUntilDateTime(waitUntilTime); logger.info("Trying until {} to {}", waitUntilTime, actionDescription); } else { stop = StopStrategies.neverStop(); logger.warn("Unbounded wait to {}", actionDescription); } WaitStrategy wait = WaitStrategies.fixedWait(sleepTimeMs, TimeUnit.MILLISECONDS); logger.info("Checking every {} milliseconds", sleepTimeMs); return RetryerBuilder.<T>newBuilder() .retryIfException(t -> exceptionClass.isInstance(t) && ((CcmException) t).isRetryable()) .retryIfResult(Objects::isNull) .withStopStrategy(stop) .withWaitStrategy(wait) .build(); }
Example #4
Source File: ServiceAccountUsageAuthorizer.java From styx with Apache License 2.0 | 5 votes |
Impl(Iam iam, CloudResourceManager crm, Directory directory, String serviceAccountUserRole, AuthorizationPolicy authorizationPolicy, WaitStrategy waitStrategy, StopStrategy retryStopStrategy, String message, List<String> administrators, List<String> blacklist) { this.iam = Objects.requireNonNull(iam, "iam"); this.crm = Objects.requireNonNull(crm, "crm"); this.directory = Objects.requireNonNull(directory, "directory"); this.serviceAccountUserRole = Objects.requireNonNull(serviceAccountUserRole, "serviceAccountUserRole"); this.authorizationPolicy = Objects.requireNonNull(authorizationPolicy, "authorizationPolicy"); this.waitStrategy = Objects.requireNonNull(waitStrategy, "waitStrategy"); this.retryStopStrategy = Objects.requireNonNull(retryStopStrategy, "retryStopStrategy"); this.message = Objects.requireNonNull(message, "message"); this.administrators = Objects.requireNonNull(administrators, "administrators"); this.blacklist = Objects.requireNonNull(blacklist, "blacklist"); }
Example #5
Source File: MqttStreamer.java From ignite with Apache License 2.0 | 2 votes |
/** * Sets the strategy to determine how long to wait between retry attempts. By default, this streamer uses a * Fibonacci-based strategy. * * @param retryWaitStrategy The retry wait strategy. */ public void setRetryWaitStrategy(WaitStrategy retryWaitStrategy) { this.retryWaitStrategy = retryWaitStrategy; }
Example #6
Source File: MqttStreamer.java From ignite with Apache License 2.0 | 2 votes |
/** * Gets the retry wait strategy. * * @return The retry wait strategy. */ public WaitStrategy getRetryWaitStrategy() { return retryWaitStrategy; }