BUG-2283 Fix close order when reconfiguring config modules.
[controller.git] / opendaylight / config / yang-test / src / main / java / org / opendaylight / controller / config / yang / test / impl / MultipleDependenciesModuleStub.txt
index 80c1e54a15e528d0b93708dfe76d506fbf03ad54..bbf2a71faa475cb9b0e3edb8c43b605135d5acb9 100644 (file)
@@ -1,5 +1,16 @@
-        return new AutoCloseable() {
+        return new org.opendaylight.controller.config.yang.test.impl.CheckedAutoCloseable() {
             @Override
-            public void close() throws Exception {
+            public synchronized void close() throws Exception {
+                if(getSingleDependency() != null && getSingleDependency().isClosed() == true) {
+                    // Simulate a cleanup on dependencies that should not be closed yet
+                    throw new java.lang.Error("Dependency was closed first");
+                }
+                for (org.opendaylight.controller.config.yang.test.impl.CheckedAutoCloseable autoCloseable : getTestingDepsDependency()) {
+                    if(autoCloseable.isClosed() == true) {
+                        // Simulate a cleanup on dependencies that should not be closed yet
+                        throw new java.lang.Error("Dependency was closed first");
+                    }
+                }
+                super.close();
             }
-        };
+        };
\ No newline at end of file