# HG changeset patch # User Martin Soch # Date 1360166606 -3600 # Node ID f87c33d2fa7b1833bedce36ff80abbe48ccb1338 # Parent fd47ec497fb204c7078c69f3f6aef318e09f9c59# Parent 93196a859fc5209d68b1e65be37fc24c187b986a merge with trunk diff -r fd47ec497fb2 -r f87c33d2fa7b vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/LaunchSetup.java --- a/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/LaunchSetup.java Wed Feb 06 15:41:19 2013 +0100 +++ b/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/LaunchSetup.java Wed Feb 06 17:03:26 2013 +0100 @@ -31,13 +31,19 @@ public final class LaunchSetup { static LaunchSetup INSTANCE = new LaunchSetup(); - private final Launcher js = Launcher.createJavaScript(); + private Launcher js; private final Map brwsrs = new LinkedHashMap<>(); private LaunchSetup() { } - public Launcher javaScript() { + public Launcher javaScript() { + return js(true); + } + private synchronized Launcher js(boolean create) { + if (js == null && create) { + js = Launcher.createJavaScript(); + } return js; } @@ -52,7 +58,9 @@ @BeforeGroups("run") public void initializeLauncher() throws IOException { - js.initialize(); + if (js(false) != null) { + js(true).initialize(); + } for (Launcher launcher : brwsrs.values()) { launcher.initialize(); } @@ -60,7 +68,9 @@ @AfterGroups("run") public void shutDownLauncher() throws IOException, InterruptedException { - js.shutdown(); + if (js(false) != null) { + js(true).shutdown(); + } for (Launcher launcher : brwsrs.values()) { launcher.shutdown(); }