Issue 746: increasing retry times for init-script

This commit is contained in:
Aled Sage 2011-12-16 02:25:01 +00:00
parent 61c2b506b6
commit aa94c60df9
1 changed files with 6 additions and 2 deletions

View File

@ -70,6 +70,11 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutput extends AbstractFu
public BlockUntilInitScriptStatusIsZeroThenReturnOutput( public BlockUntilInitScriptStatusIsZeroThenReturnOutput(
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
final ScriptStatusReturnsZero stateRunning, @Assisted final SudoAwareInitManager commandRunner) { final ScriptStatusReturnsZero stateRunning, @Assisted final SudoAwareInitManager commandRunner) {
long retryMaxWait = TimeUnit.DAYS.toMillis(365); // arbitrarily high value, but Long.MAX_VALUE doesn't work!
long retryPeriod = 500;
long retryMaxPeriod = 5000;
this.commandRunner = checkNotNull(commandRunner, "commandRunner"); this.commandRunner = checkNotNull(commandRunner, "commandRunner");
this.userThreads = checkNotNull(userThreads, "userThreads"); this.userThreads = checkNotNull(userThreads, "userThreads");
this.notRunningAnymore = new RetryablePredicate<String>(new Predicate<String>() { this.notRunningAnymore = new RetryablePredicate<String>(new Predicate<String>() {
@ -78,8 +83,7 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutput extends AbstractFu
public boolean apply(String arg0) { public boolean apply(String arg0) {
return commandRunner.runAction(arg0).getOutput().trim().equals(""); return commandRunner.runAction(arg0).getOutput().trim().equals("");
} }
// arbitrarily high value, but Long.MAX_VALUE doesn't work! }, retryMaxWait, retryPeriod, retryMaxPeriod, TimeUnit.MILLISECONDS) {
}, TimeUnit.DAYS.toMillis(365)) {
/** /**
* make sure we stop the retry loop if someone cancelled the future, this keeps threads * make sure we stop the retry loop if someone cancelled the future, this keeps threads
* from being consumed on dead tasks * from being consumed on dead tasks