X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Ftest%2FConcurrentDataBrokerTestCustomizer.java;h=ee761f4919c0a480ea2268156a2ecfff98c502d8;hp=0b2de070f8f5109694cc2bfb2e3ca5adb0be7560;hb=47f9449f977820bc605bafa23e81ee2efe6d9f37;hpb=1e50fbad8d8605b73d5b2be8f5ae30b437b33780 diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/ConcurrentDataBrokerTestCustomizer.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/ConcurrentDataBrokerTestCustomizer.java index 0b2de070f8..ee761f4919 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/ConcurrentDataBrokerTestCustomizer.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/ConcurrentDataBrokerTestCustomizer.java @@ -21,12 +21,24 @@ import java.util.concurrent.Executors; */ public class ConcurrentDataBrokerTestCustomizer extends AbstractDataBrokerTestCustomizer { + private final ListeningExecutorService dataTreeChangeListenerExecutorSingleton; + + public ConcurrentDataBrokerTestCustomizer(boolean useMTDataTreeChangeListenerExecutor) { + if (useMTDataTreeChangeListenerExecutor) { + dataTreeChangeListenerExecutorSingleton = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool()); + } else { + dataTreeChangeListenerExecutorSingleton = MoreExecutors.newDirectExecutorService(); + } + } + @Override public ListeningExecutorService getCommitCoordinatorExecutor() { return MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()); } - public void useMTDataTreeChangeListenerExecutor() { - setDataTreeChangeListenerExecutor(MoreExecutors.listeningDecorator(Executors.newCachedThreadPool())); + @Override + public ListeningExecutorService getDataTreeChangeListenerExecutor() { + return dataTreeChangeListenerExecutorSingleton; } + }