Ensure sequential execution of configuration writer threads (#516)

* Ensure sequential execution of configuration writer threads

Signed-off-by: Chang Feng <[email protected]>

* Change method to add synchronized to action

Signed-off-by: Chang Feng <[email protected]>
This commit is contained in:
Feng Chang authored and Haowei Wen committed 2019-02-04 02:18:24 +08:00
1 parent 0c25f31493
commit f20c11a4e2
1 file changed
+3 -1
@@ -33,7 +33,9 @@ public class InvocationDispatcher<ARG> implements Consumer<ARG> {
public static <ARG> InvocationDispatcher<ARG> runOn(Consumer<Runnable> executor, Consumer<ARG> action) {
return new InvocationDispatcher<>(arg -> executor.accept(() -> {
action.accept(arg.get());
synchronized (action) {
action.accept(arg.get());
}
}));
}