From 5efcea6839ce570386cd525a270066f63c089aad Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Mon, 12 Mar 2012 15:56:15 +0000 Subject: [PATCH] changed delay to sockettester --- .../functions/admin/StartVBoxIfNotAlreadyRunning.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java index 750dac9399..1a796c83ba 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/StartVBoxIfNotAlreadyRunning.java @@ -70,7 +70,7 @@ public class StartVBoxIfNotAlreadyRunning implements Supplier @Provider Supplier providerSupplier, @Identity String identity, @Credential String credential) { this.runScriptOnNodeFactory = checkNotNull(runScriptOnNodeFactory, "runScriptOnNodeFactory"); this.socketTester = checkNotNull(socketTester, "socketTester"); - this.socketTester.seconds(1L); + this.socketTester.seconds(3L); this.host = checkNotNull(host, "host"); this.providerSupplier = checkNotNull(providerSupplier, "endpoint to virtualbox websrvd is needed"); this.identity = checkNotNull(identity, "identity"); @@ -94,10 +94,8 @@ public class StartVBoxIfNotAlreadyRunning implements Supplier runScriptOnNodeFactory.create(host.get(), Statements.exec(vboxwebsrv), runAsRoot(false).wrapInInitScript(false).blockOnComplete(false).nameTask("vboxwebsrv")).init().call(); - try { - // wait for a couple of seconds to make sure vbox has correctly started - Thread.sleep(2000L); - } catch (InterruptedException e) { + if (!!socketTester.apply(new IPSocket(provider.getHost(), provider.getPort()))){ + throw new RuntimeException("could not connect to virtualbox"); } } manager = managerForNode.apply(host);