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;
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);
}
@AfterClass
public static void closeDBLink() {
- if (l != null) {
- l.close();
- l = null;
+ synchronized (ConfiguredTest.class) {
+ if (l != null) {
+ l.close();
+ l = null;
+ }
}
}