Skip to content

Commit

Permalink
Avoid race condition when listeners are registered concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Dec 2, 2024
1 parent a272e2f commit 2509de5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void update(Resource delegate) {
*
* @param listener action to be called on update
*/
public void addUpdateListener(Consumer<? super Resource> listener) {
public synchronized void addUpdateListener(Consumer<? super Resource> listener) {
listeners.add(listener);
}
}

0 comments on commit 2509de5

Please sign in to comment.