@Override public void setConf(Configuration conf) { super.setConf(conf); if (conf == null) { // Configured gets passed null before real conf. Why? I don't know. return; } sshUserName = conf.get("hbase.it.clustermanager.ssh.user", ""); String extraSshOptions = conf.get("hbase.it.clustermanager.ssh.opts", ""); sshOptions = System.getenv("HBASE_SSH_OPTS"); if (!extraSshOptions.isEmpty()) { sshOptions = StringUtils.join(new Object[] { sshOptions, extraSshOptions }, " "); } sshOptions = (sshOptions == null) ? "" : sshOptions; sshUserName = (sshUserName == null) ? "" : sshUserName; tunnelCmd = conf.get("hbase.it.clustermanager.ssh.cmd", DEFAULT_TUNNEL_CMD); // Print out ssh special config if any. if ((sshUserName != null && sshUserName.length() > 0) || (sshOptions != null && sshOptions.length() > 0)) { LOG.info("Running with SSH user [" + sshUserName + "] and options [" + sshOptions + "]"); } this.retryCounterFactory = new RetryCounterFactory(new RetryConfig() .setMaxAttempts(conf.getInt(RETRY_ATTEMPTS_KEY, DEFAULT_RETRY_ATTEMPTS)) .setSleepInterval(conf.getLong(RETRY_SLEEP_INTERVAL_KEY, DEFAULT_RETRY_SLEEP_INTERVAL))); }
@Override public void setConf(Configuration conf) { super.setConf(conf); if (conf == null) { // Configured gets passed null before real conf. Why? I don't know. return; } sshUserName = conf.get("hbase.it.clustermanager.ssh.user", ""); String extraSshOptions = conf.get("hbase.it.clustermanager.ssh.opts", ""); sshOptions = System.getenv("HBASE_SSH_OPTS"); if (!extraSshOptions.isEmpty()) { sshOptions = StringUtils.join(new Object[] { sshOptions, extraSshOptions }, " "); } sshOptions = (sshOptions == null) ? "" : sshOptions; sshUserName = (sshUserName == null) ? "" : sshUserName; tunnelCmd = conf.get("hbase.it.clustermanager.ssh.cmd", DEFAULT_TUNNEL_CMD); // Print out ssh special config if any. if ((sshUserName != null && sshUserName.length() > 0) || (sshOptions != null && sshOptions.length() > 0)) { LOG.info("Running with SSH user [" + sshUserName + "] and options [" + sshOptions + "]"); } this.retryCounterFactory = new RetryCounterFactory(new RetryConfig() .setMaxAttempts(conf.getInt(RETRY_ATTEMPTS_KEY, DEFAULT_RETRY_ATTEMPTS)) .setSleepInterval(conf.getLong(RETRY_SLEEP_INTERVAL_KEY, DEFAULT_RETRY_SLEEP_INTERVAL))); }
public RetryCounter(int maxAttempts, long sleepInterval, TimeUnit timeUnit) { this(new RetryConfig(maxAttempts, sleepInterval, -1, timeUnit, new ExponentialBackoffPolicy())); }
public RetryCounter(int maxAttempts, long sleepInterval, TimeUnit timeUnit) { this(new RetryConfig(maxAttempts, sleepInterval, -1, timeUnit, new ExponentialBackoffPolicy())); }
public RetryCounter(int maxAttempts, long sleepInterval, TimeUnit timeUnit) { this(new RetryConfig(maxAttempts, sleepInterval, -1, timeUnit, new ExponentialBackoffPolicy())); }
public RetryCounterFactory(int maxAttempts, int sleepIntervalMillis, int maxSleepTime) { this(new RetryConfig( maxAttempts, sleepIntervalMillis, maxSleepTime, TimeUnit.MILLISECONDS, new ExponentialBackoffPolicyWithLimit())); }
public RetryCounterFactory(int maxAttempts, int sleepIntervalMillis, int maxSleepTime) { this(new RetryConfig( maxAttempts, sleepIntervalMillis, maxSleepTime, TimeUnit.MILLISECONDS, new ExponentialBackoffPolicyWithLimit())); }
public RetryCounterFactory(int maxAttempts, int sleepIntervalMillis, int maxSleepTime) { this(new RetryConfig( maxAttempts, sleepIntervalMillis, maxSleepTime, TimeUnit.MILLISECONDS, new ExponentialBackoffPolicyWithLimit())); }
public RetryCounter(int maxAttempts, long sleepInterval, TimeUnit timeUnit) { this(new RetryConfig(maxAttempts, sleepInterval, -1, timeUnit, new ExponentialBackoffPolicy())); }
public RetryCounterFactory(int maxAttempts, int sleepIntervalMillis, int maxSleepTime) { this(new RetryConfig( maxAttempts, sleepIntervalMillis, maxSleepTime, TimeUnit.MILLISECONDS, new ExponentialBackoffPolicyWithLimit())); }
/** * Get an exponential backoff retry counter. The base unit is 100 milliseconds, and the max * backoff time is 30 seconds. */ public static RetryCounter getRetryCounter() { return new RetryCounterFactory( new RetryCounter.RetryConfig().setBackoffPolicy(new RetryCounter.ExponentialBackoffPolicy()) .setSleepInterval(100).setMaxSleepTime(30000).setMaxAttempts(Integer.MAX_VALUE) .setTimeUnit(TimeUnit.MILLISECONDS).setJitter(0.01f)).create(); } }