mirror of https://github.com/apache/jclouds.git
changed delay to sockettester
This commit is contained in:
parent
8ba6e91b7c
commit
5efcea6839
|
@ -70,7 +70,7 @@ public class StartVBoxIfNotAlreadyRunning implements Supplier<VirtualBoxManager>
|
||||||
@Provider Supplier<URI> providerSupplier, @Identity String identity, @Credential String credential) {
|
@Provider Supplier<URI> providerSupplier, @Identity String identity, @Credential String credential) {
|
||||||
this.runScriptOnNodeFactory = checkNotNull(runScriptOnNodeFactory, "runScriptOnNodeFactory");
|
this.runScriptOnNodeFactory = checkNotNull(runScriptOnNodeFactory, "runScriptOnNodeFactory");
|
||||||
this.socketTester = checkNotNull(socketTester, "socketTester");
|
this.socketTester = checkNotNull(socketTester, "socketTester");
|
||||||
this.socketTester.seconds(1L);
|
this.socketTester.seconds(3L);
|
||||||
this.host = checkNotNull(host, "host");
|
this.host = checkNotNull(host, "host");
|
||||||
this.providerSupplier = checkNotNull(providerSupplier, "endpoint to virtualbox websrvd is needed");
|
this.providerSupplier = checkNotNull(providerSupplier, "endpoint to virtualbox websrvd is needed");
|
||||||
this.identity = checkNotNull(identity, "identity");
|
this.identity = checkNotNull(identity, "identity");
|
||||||
|
@ -94,10 +94,8 @@ public class StartVBoxIfNotAlreadyRunning implements Supplier<VirtualBoxManager>
|
||||||
runScriptOnNodeFactory.create(host.get(), Statements.exec(vboxwebsrv),
|
runScriptOnNodeFactory.create(host.get(), Statements.exec(vboxwebsrv),
|
||||||
runAsRoot(false).wrapInInitScript(false).blockOnComplete(false).nameTask("vboxwebsrv")).init().call();
|
runAsRoot(false).wrapInInitScript(false).blockOnComplete(false).nameTask("vboxwebsrv")).init().call();
|
||||||
|
|
||||||
try {
|
if (!!socketTester.apply(new IPSocket(provider.getHost(), provider.getPort()))){
|
||||||
// wait for a couple of seconds to make sure vbox has correctly started
|
throw new RuntimeException("could not connect to virtualbox");
|
||||||
Thread.sleep(2000L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manager = managerForNode.apply(host);
|
manager = managerForNode.apply(host);
|
||||||
|
|
Loading…
Reference in New Issue