fix broken DataTreeEventCallbackRegistrar onAddOrUpdate() 36/73136/2
authorMichael Vorburger <vorburger@redhat.com>
Mon, 18 Jun 2018 14:29:14 +0000 (16:29 +0200)
committerMichael Vorburger <vorburger@redhat.com>
Mon, 18 Jun 2018 15:42:32 +0000 (17:42 +0200)
actually fixes two technically completely unrelated bugs:
firstly the use of onUpdate instead of onAddOrUpdate in
two API default methods; and secondly a hard-coded
Duration.ZERO instead of timeoutDuration impl arg.

Change-Id: I6c2092d1b48fafe1a6b90821f0907cb2e064bac1
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/datastoreutils/listeners/DataTreeEventCallbackRegistrar.java
mdsalutil/mdsalutil-impl/src/main/java/org/opendaylight/genius/datastoreutils/listeners/internal/DataTreeEventCallbackRegistrarImpl.java

index cf855f49f1b1191e94e66acc49d2ee9c55809aa1..49df103c6a5d40cb3786610ccd3692a39883a126 100644 (file)
@@ -123,7 +123,7 @@ public interface DataTreeEventCallbackRegistrar {
      */
     default <T extends DataObject> void onAddOrUpdate(LogicalDatastoreType store, InstanceIdentifier<T> path,
                                                  BiConsumer<@Nullable T, T> callback) {
-        onUpdate(store, path, (t1, t2) -> {
+        onAddOrUpdate(store, path, (t1, t2) -> {
             callback.accept(t1, t2);
             return UNREGISTER;
         });
@@ -132,7 +132,7 @@ public interface DataTreeEventCallbackRegistrar {
     default <T extends DataObject> void onAddOrUpdate(LogicalDatastoreType store, InstanceIdentifier<T> path,
             BiConsumer<@Nullable T, T> callback,
             Duration timeoutDuration, Consumer<DataTreeIdentifier<T>> timedOutCallback) {
-        onUpdate(store, path, (t1, t2) -> {
+        onAddOrUpdate(store, path, (t1, t2) -> {
             callback.accept(t1, t2);
             return UNREGISTER;
         }, timeoutDuration, timedOutCallback);
index 26351a70f178b60486a80a04f2cb109cf04cc5b1..b2ffe3bcc6cc50e6025928914bbdb3f22d9433cc 100644 (file)
@@ -117,7 +117,7 @@ public class DataTreeEventCallbackRegistrarImpl implements DataTreeEventCallback
             BiFunction<@org.eclipse.jdt.annotation.Nullable T, T, NextAction> callback, Duration timeoutDuration,
             Consumer<DataTreeIdentifier<T>> timedOutCallback) {
         validateTimeout(timeoutDuration);
-        on(Operation.ADD_OR_UPDATE, store, path, callback, Duration.ZERO,
+        on(Operation.ADD_OR_UPDATE, store, path, callback, timeoutDuration,
                 requireNonNull(timedOutCallback, "timedOutCallback"));
     }