Ensure sequential execution of configuration writer threads (#516)

* Ensure sequential execution of configuration writer threads

Signed-off-by: Chang Feng <chang_196700@hotmail.com>

* Change method to add synchronized to action

Signed-off-by: Chang Feng <chang_196700@hotmail.com>
This commit is contained in:
Feng Chang 2019-02-04 02:18:24 +08:00 committed by Haowei Wen
parent 0c25f31493
commit f20c11a4e2

View File

@ -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());
}
}));
}