X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2Ftree%2Fdata%2FModifiedNode.java;h=f83ea1a2de36f3b326bf3dc1b7404a2e80348def;hp=0ff64e6a72afceb3faaeffb76491744f85dc4ca2;hb=066845485745859ffd16fdceee0c8cb264b1bd7f;hpb=f2df8835acd421467dbf5adaf1aa71609eac1512 diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/ModifiedNode.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/ModifiedNode.java index 0ff64e6a72..f83ea1a2de 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/ModifiedNode.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/ModifiedNode.java @@ -20,7 +20,6 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import com.google.common.base.Optional; -import com.google.common.base.Preconditions; import com.google.common.base.Predicate; /** @@ -50,25 +49,17 @@ final class ModifiedNode implements StoreTreeNode, Identifiable children = new LinkedHashMap<>(); private final Optional original; - - private NormalizedNode value; - + private final PathArgument identifier; + private ModificationType modificationType = ModificationType.UNMODIFIED; private Optional snapshotCache; - - private final Map childModification; - - @GuardedBy("this") - private boolean sealed = false; + private NormalizedNode value; private ModifiedNode(final PathArgument identifier, final Optional original) { this.identifier = identifier; this.original = original; - childModification = new LinkedHashMap<>(); } /** @@ -91,7 +82,7 @@ final class ModifiedNode implements StoreTreeNode, Identifiable getOriginal() { + public Optional getOriginal() { return original; } @@ -101,7 +92,7 @@ final class ModifiedNode implements StoreTreeNode, Identifiable, Identifiable getChild(final PathArgument child) { - return Optional. fromNullable(childModification.get(child)); + return Optional. fromNullable(children.get(child)); } /** @@ -130,13 +121,12 @@ final class ModifiedNode implements StoreTreeNode, Identifiable, Identifiable, Identifiable getChildren() { - return childModification.values(); + return children.values(); } /** @@ -170,11 +160,10 @@ final class ModifiedNode implements StoreTreeNode, Identifiable, Identifiable value) { - checkSealed(); + public void write(final NormalizedNode value) { clearSnapshot(); updateModificationType(ModificationType.WRITE); - childModification.clear(); + children.clear(); this.value = value; } - public synchronized void merge(final NormalizedNode data) { - checkSealed(); + public void merge(final NormalizedNode data) { clearSnapshot(); updateModificationType(ModificationType.MERGE); // FIXME: Probably merge with previous value. this.value = data; } - @GuardedBy("this") - private void checkSealed() { - Preconditions.checkState(!sealed, "Node Modification is sealed. No further changes allowed."); - } - - public synchronized void seal() { - sealed = true; + void seal() { clearSnapshot(); - for(ModifiedNode child : childModification.values()) { + for (ModifiedNode child : children.values()) { child.seal(); } } @@ -235,7 +216,7 @@ final class ModifiedNode implements StoreTreeNode, Identifiable