X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fclub%2Fwpia%2Fgigi%2FtestUtils%2FConfiguredTest.java;h=483f25e1d80a99deb37029e538ce4840ae7f61fc;hb=f14ca64e640fc3a9ea5f9cc035413bc095c4fd30;hp=cdacf6922f0f4af08d51e5484f210211fa96b654;hpb=f9c330aaf4537d80cb6bb4a0734b2fe7fe5c6b89;p=gigi.git diff --git a/tests/club/wpia/gigi/testUtils/ConfiguredTest.java b/tests/club/wpia/gigi/testUtils/ConfiguredTest.java index cdacf692..483f25e1 100644 --- a/tests/club/wpia/gigi/testUtils/ConfiguredTest.java +++ b/tests/club/wpia/gigi/testUtils/ConfiguredTest.java @@ -78,6 +78,15 @@ public abstract class ConfiguredTest { public static Properties initEnvironment() throws IOException { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); if (envInited) { + try { + synchronized (ConfiguredTest.class) { + if (l == null) { + l = DatabaseConnection.newLink(false); + } + } + } catch (InterruptedException e) { + throw new Error(e); + } return generateProps(); } envInited = true; @@ -93,7 +102,11 @@ public abstract class ConfiguredTest { if ( !DatabaseConnection.isInited()) { DatabaseConnection.init(testProps); try { - l = DatabaseConnection.newLink(false); + synchronized (ConfiguredTest.class) { + if (l == null) { + l = DatabaseConnection.newLink(false); + } + } } catch (InterruptedException e) { throw new Error(e); } @@ -104,9 +117,11 @@ public abstract class ConfiguredTest { @AfterClass public static void closeDBLink() { - if (l != null) { - l.close(); - l = null; + synchronized (ConfiguredTest.class) { + if (l != null) { + l.close(); + l = null; + } } }