From aa94c60df91407308246e1e2094cdca85ad12f30 Mon Sep 17 00:00:00 2001 From: Aled Sage Date: Fri, 16 Dec 2011 02:25:01 +0000 Subject: [PATCH] Issue 746: increasing retry times for init-script --- .../BlockUntilInitScriptStatusIsZeroThenReturnOutput.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compute/src/main/java/org/jclouds/compute/callables/BlockUntilInitScriptStatusIsZeroThenReturnOutput.java b/compute/src/main/java/org/jclouds/compute/callables/BlockUntilInitScriptStatusIsZeroThenReturnOutput.java index e4f642f129..1d964534e4 100644 --- a/compute/src/main/java/org/jclouds/compute/callables/BlockUntilInitScriptStatusIsZeroThenReturnOutput.java +++ b/compute/src/main/java/org/jclouds/compute/callables/BlockUntilInitScriptStatusIsZeroThenReturnOutput.java @@ -70,6 +70,11 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutput extends AbstractFu public BlockUntilInitScriptStatusIsZeroThenReturnOutput( @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads, 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.userThreads = checkNotNull(userThreads, "userThreads"); this.notRunningAnymore = new RetryablePredicate(new Predicate() { @@ -78,8 +83,7 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutput extends AbstractFu public boolean apply(String arg0) { return commandRunner.runAction(arg0).getOutput().trim().equals(""); } - // arbitrarily high value, but Long.MAX_VALUE doesn't work! - }, TimeUnit.DAYS.toMillis(365)) { + }, retryMaxWait, retryPeriod, retryMaxPeriod, TimeUnit.MILLISECONDS) { /** * make sure we stop the retry loop if someone cancelled the future, this keeps threads * from being consumed on dead tasks