Bug 8163: getDataTreeChangeListenerExecutor() & DataBrokerTestModule
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / md / sal / binding / test / ConcurrentDataBrokerTestCustomizer.java
index 0b2de07..ee761f4 100644 (file)
@@ -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;
     }
+
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.