Skip to content

Commit c620c37

Browse files
committed
[java] Use double-checked locking to initialise the Selenium Manager instance
1 parent f2d8427 commit c620c37

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

java/src/org/openqa/selenium/manager/SeleniumManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class SeleniumManager {
6565
private static final String WARN = "WARN";
6666
private static final String DEBUG = "DEBUG";
6767

68-
private static SeleniumManager manager;
68+
private static volatile SeleniumManager manager;
6969

7070
private File binary;
7171

@@ -90,7 +90,11 @@ private SeleniumManager() {
9090

9191
public static SeleniumManager getInstance() {
9292
if (manager == null) {
93-
manager = new SeleniumManager();
93+
synchronized (SeleniumManager.class) {
94+
if (manager == null) {
95+
manager = new SeleniumManager();
96+
}
97+
}
9498
}
9599
return manager;
96100
}

0 commit comments

Comments
 (0)