Sets the strategy that sleeps a random amount of time before retrying

@param maximum
@param timeUnit
@return
510438
public Retryer<R> randomWait(long maximum, TimeUnit timeUnit) {
        return randomWait(0L, checkNotNull(timeUnit).toMillis(maximum));
    }
1351249
@Override
    public void setMaxInactiveInterval(int time) {
        this.maxInactiveTimeSetting = time;
        if (time < 0) {
            this.maxInactiveTime = NO_TIMEOUT;
        } else {
            this.maxInactiveTime = (time * 1000L);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "max-inactive time: " + this.maxInactiveTimeSetting);
        }
    }
1070290
public void randomWait(long min, long max) {
		final long waitTime = randomLong(min, max);
		try {
			Thread.sleep(waitTime);
		} catch (InterruptedException interruptedException) {
			// ignored
		}
	}
1021007
public static void sleep(final long duration, final TimeUnit unit) {
		try {
			Thread.sleep(unit.toMillis(duration));
		} catch (InterruptedException e) {
			LOG.trace("", e);
			Thread.currentThread().interrupt();
		}
	}
399833
public synchronized boolean      waitOnBarrier(long maxWait, TimeUnit unit) throws Exception
    {
        long            startMs = System.currentTimeMillis();
        boolean         hasMaxWait = (unit != null);
        long            maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;

        boolean         result;
        for(;;)
        {
            result = (client.checkExists().usingWatcher(watcher).forPath(barrierPath) == null);
            if ( result )
            {
                break;
            }

            if ( hasMaxWait )
            {
                long        elapsed = System.currentTimeMillis() - startMs;
                long        thisWaitMs = maxWaitMs - elapsed;
                if ( thisWaitMs <= 0 )
                {
                    break;
                }
                wait(thisWaitMs);
            }
            else
            {
                wait();
            }
        }
        return result;
    }
599286
public final Cache2kBuilder<K, V> retryInterval(long v, TimeUnit u) {
    config().setRetryInterval(u.toMillis(v));
    return this;
  }
882872
@Nonnull
  public CacheControlBuilder setSharedMaxAge (@Nonnull final TimeUnit eTimeUnit, final long nDuration)
  {
    return setSharedMaxAgeSeconds (eTimeUnit.toSeconds (nDuration));
  }
1195788
static ClockNormalizer ofOnlyMode(ClockUnit unit) {

        ClockNormalizer ret = MAP_ONLY.get(unit);

        if (ret == null) {
            throw new IllegalArgumentException(unit.name());
        }

        return ret;

    }
478171
public static <V> Action1<TaskContext<V>> exponentialWait(long initTime, long maxTime, TimeUnit timeUnit) {
        return exponentialWait(initTime, maxTime, timeUnit, 2);
    }
389578
public Retryer<R> exponentialWait(long multiplier, long maximumTime, TimeUnit maximumUnit) {
        return exponentialWait(multiplier, checkNotNull(maximumUnit).toMillis(maximumTime));
    }
666363
public static Timeout create(long timeout, TimeUnit timeUnit) {

        LettuceAssert.notNull(timeUnit, "TimeUnit must not be null");

        return new Timeout(Duration.ofNanos(timeUnit.toNanos(timeout)));
    }
1157904
public Retryer<R> timeout(long duration, TimeUnit timeUnit) {
        return timeout(duration, timeUnit, null);
    }
66185
public boolean await(long maxWait, TimeUnit timeUnit) throws Exception
    {
        boolean hasWait = (timeUnit != null);
        long startMs = System.currentTimeMillis();
        for (;;)
        {
            String status = client.command().status(queryId).invoke().get().getStatus();
            if (status.equalsIgnoreCase(STATUS_DONE))
            {
                break;
            }
            if (!status.equalsIgnoreCase(STATUS_RUNNING) && !status.equalsIgnoreCase(STATUS_WAITING))
            {
                throw new Exception(String.format("Bad status for query %s: %s", queryId, status));
            }

            if (hasWait)
            {
                long elapsedMs = System.currentTimeMillis() - startMs;
                if (elapsedMs >= timeUnit.toMillis(maxWait))
                {
                    return false;
                }
            }
            Thread.sleep(pollMs.get());
        }
        return true;
    }
261161
public void setTimeout(long timeout, TimeUnit unit)
    {
        this.timeout = TimeUnit.MILLISECONDS.convert(timeout, unit);
    }
819943
public static RestartStrategyFactory createRestartStrategyFactory(Configuration configuration) throws Exception {
		String restartStrategyName = configuration.getString(ConfigConstants.RESTART_STRATEGY, null);

		if (restartStrategyName == null) {
			// support deprecated ConfigConstants values
			final int numberExecutionRetries = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS,
				ConfigConstants.DEFAULT_EXECUTION_RETRIES);
			String pauseString = configuration.getString(AkkaOptions.WATCH_HEARTBEAT_PAUSE);
			String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY,
				pauseString);

			long delay;

			try {
				delay = Duration.apply(delayString).toMillis();
			} catch (NumberFormatException nfe) {
				if (delayString.equals(pauseString)) {
					throw new Exception("Invalid config value for " +
						AkkaOptions.WATCH_HEARTBEAT_PAUSE.key() + ": " + pauseString +
						". Value must be a valid duration (such as '10 s' or '1 min')");
				} else {
					throw new Exception("Invalid config value for " +
						ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString +
						". Value must be a valid duration (such as '100 milli' or '10 s')");
				}
			}

			if (numberExecutionRetries > 0 && delay >= 0) {
				return new FixedDelayRestartStrategy.FixedDelayRestartStrategyFactory(numberExecutionRetries, delay);
			} else {
				return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory();
			}
		}

		switch (restartStrategyName.toLowerCase()) {
			case "none":
			case "off":
			case "disable":
				return NoRestartStrategy.createFactory(configuration);
			case "fixeddelay":
			case "fixed-delay":
				return FixedDelayRestartStrategy.createFactory(configuration);
			case "failurerate":
			case "failure-rate":
				return FailureRateRestartStrategy.createFactory(configuration);
			default:
				try {
					Class<?> clazz = Class.forName(restartStrategyName);

					if (clazz != null) {
						Method method = clazz.getMethod(CREATE_METHOD, Configuration.class);

						if (method != null) {
							Object result = method.invoke(null, configuration);

							if (result != null) {
								return (RestartStrategyFactory) result;
							}
						}
					}
				} catch (ClassNotFoundException cnfe) {
					LOG.warn("Could not find restart strategy class {}.", restartStrategyName);
				} catch (NoSuchMethodException nsme) {
					LOG.warn("Class {} does not has static method {}.", restartStrategyName, CREATE_METHOD);
				} catch (InvocationTargetException ite) {
					LOG.warn("Cannot call static method {} from class {}.", CREATE_METHOD, restartStrategyName);
				} catch (IllegalAccessException iae) {
					LOG.warn("Illegal access while calling method {} from class {}.", CREATE_METHOD, restartStrategyName);
				}

				// fallback in case of an error
				return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory();
		}
	}
612210
public FluoConfiguration setTransactionRollbackTime(long time, TimeUnit tu) {
    return setPositiveLong(TRANSACTION_ROLLBACK_TIME_PROP, tu.toMillis(time));
  }
611897
@Override
    public Configuration defaultTimeout(long time, TimeUnit unit) {
        return defaultTimeout(new Duration(time, unit));
    }