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 / CheckedAutoCloseable.java
diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/CheckedAutoCloseable.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/CheckedAutoCloseable.java
new file mode 100644 (file)
index 0000000..74cf617
--- /dev/null
@@ -0,0 +1,17 @@
+package org.opendaylight.controller.config.yang.test.impl;
+
+import com.google.common.base.Preconditions;
+
+public class CheckedAutoCloseable implements AutoCloseable {
+    private boolean closed = false;
+
+    @Override
+    public synchronized void close() throws Exception {
+        Preconditions.checkState(closed == false);
+        this.closed = true;
+    }
+
+    public synchronized boolean isClosed() {
+        return this.closed;
+    }
+}