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.
  • Loading branch information
pujagani committed Oct 23, 2020
1 parent 7f376a6 commit 40a6aa8
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ 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) {
bus = localBus = createBus();
}
}
}

return bus;
return localBus;
}

private EventBus createBus() {
Expand Down

0 comments on commit 40a6aa8

Please sign in to comment.