Skip to content

Commit

Permalink
[event-bus] Fix the double check for lazy initialisation of EventBus …
Browse files Browse the repository at this point in the history
…instance in EventBusOptions. (SeleniumHQ#8817)
  • Loading branch information
pujagani committed Oct 26, 2020
1 parent 8580ae1 commit bc89931
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ public EventBusOptions(Config config) {
}

public EventBus getEventBus() {
if (bus == null) {
EventBus localBus = bus;
if (localBus == null) {
synchronized (this) {
if (bus == null) {
bus = createBus();
localBus = bus;
if (localBus == null) {
localBus = createBus();
bus = localBus;
}
}
}

return bus;
return localBus;
}

private EventBus createBus() {
Expand Down

0 comments on commit bc89931

Please sign in to comment.