Skip to content

Commit bc89931

Browse files
authored
[event-bus] Fix the double check for lazy initialisation of EventBus instance in EventBusOptions. (#8817)
1 parent 8580ae1 commit bc89931

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

java/server/src/org/openqa/selenium/grid/server/EventBusOptions.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ public EventBusOptions(Config config) {
3333
}
3434

3535
public EventBus getEventBus() {
36-
if (bus == null) {
36+
EventBus localBus = bus;
37+
if (localBus == null) {
3738
synchronized (this) {
38-
if (bus == null) {
39-
bus = createBus();
39+
localBus = bus;
40+
if (localBus == null) {
41+
localBus = createBus();
42+
bus = localBus;
4043
}
4144
}
4245
}
4346

44-
return bus;
47+
return localBus;
4548
}
4649

4750
private EventBus createBus() {

0 commit comments

Comments
 (0)