summaryrefslogtreecommitdiffstats
path: root/infra/data-api
diff options
context:
space:
mode:
authorMaros Marsalek <maros.mars@gmail.com>2017-09-04 14:37:57 +0200
committerMaroš Maršalek <maros.mars@gmail.com>2017-09-05 11:18:28 +0000
commit0d4a04e1452e19ce96c308cd45a430a3f5b72f04 (patch)
tree22f71b904209922ad2a3f8ed77f0e647346196db /infra/data-api
parent6506878ae7ad2b9ade390127ece11f7a1a3b67dd (diff)
Make DataModification closeable
and close the modification from transactions. This enables cleanup of underlay resources per transaction. It is not needed when managing VPP, but might be useful for other use-cases where underlay transactions are involved. Change-Id: If14197052172be0158fd7efb5ee1794935d576bc Signed-off-by: Maros Marsalek <maros.mars@gmail.com>
Diffstat (limited to 'infra/data-api')
-rw-r--r--infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java b/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java
index 6e903a4e2..22fba0f53 100644
--- a/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java
+++ b/infra/data-api/src/main/java/io/fd/honeycomb/data/DataModification.java
@@ -26,7 +26,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailed
* Modification of a {@link ModifiableDataManager}.
*/
@Beta
-public interface DataModification extends ReadableDataManager {
+public interface DataModification extends ReadableDataManager, AutoCloseable {
/**
* Delete the node at specified path.
@@ -67,4 +67,12 @@ public interface DataModification extends ReadableDataManager {
* @throws DataValidationFailedException if modification data is not valid
*/
void validate() throws DataValidationFailedException;
+
+ /**
+ * Perform cleanup if necessary.
+ */
+ @Override
+ default void close() {
+ // by default, no cleanup is required
+ }
}