From 6724dddb6faaed11a6f7e1d2fa701e0ba6b92bb2 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 18 Jun 2019 17:39:37 +0200 Subject: [PATCH] Fix IMDS test synchronization Before we close the DTCL we must make sure we flush all changes, otherwise we could end up losing changes simply because we are no longer interested in them. JIRA: MDSAL-429 Change-Id: I6df384c375ea1692a10c9f460d3dceb626468061 Signed-off-by: Robert Varga --- .../controller/md/sal/dom/store/impl/DatastoreTestTask.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java index a62c0ba88f..74202a51e4 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java @@ -119,6 +119,10 @@ public class DatastoreTestTask { execute(write); if (registration != null) { + // DCL is asynchronous, we need to make sure all tasks are executed before we close the registration, + // otherwise they would get lost + dclExecutorService.shutdown(); + dclExecutorService.awaitTermination(5, TimeUnit.SECONDS); registration.close(); } -- 2.36.6