Fix up release old producers to avoid memory leak
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / shard / DOMDataTreeShardProducer.java
index cb1f2b1c808e8a7bc03242635ee45c216aa40e49..0ae5876c673431b720fd1dd6fbdac6c55ea928de 100644 (file)
@@ -11,9 +11,10 @@ import com.google.common.annotations.Beta;
 import java.util.Collection;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
+import org.opendaylight.yangtools.concepts.Registration;
 
 @Beta
-public interface DOMDataTreeShardProducer {
+public interface DOMDataTreeShardProducer extends Registration {
     /**
      * Return the collection of tree identifiers to which this producer is bound. This collection
      * is constant during the lifetime of a producer.
@@ -30,4 +31,14 @@ public interface DOMDataTreeShardProducer {
      * @throws IllegalStateException if a previous transaction has not been closed
      */
     @NonNull DOMDataTreeShardWriteTransaction createTransaction();
+
+    /**
+     * Close this producer, releasing all resources. Default implementation does nothing, implementations should provide
+     * an implementation.
+     */
+    // FIXME: 4.0.0: make this method non-default
+    @Override
+    default void close() {
+
+    }
 }