BUG-509: limit visibility of updateModificationType() 94/5994/2
authorRobert Varga <rovarga@cisco.com>
Wed, 9 Apr 2014 04:20:17 +0000 (06:20 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Wed, 9 Apr 2014 11:02:20 +0000 (11:02 +0000)
Limits updateModificationType() to private. Also add GuardedBy
annotations to explain that seal and this method require
synchronization.

Change-Id: Iff49e15c890bac38cb5ff19c347551dcee5bb4b8
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/NodeModification.java

index a0c15eb..04fb3b7 100644 (file)
@@ -12,6 +12,8 @@ import static com.google.common.base.Preconditions.checkState;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+import javax.annotation.concurrent.GuardedBy;
+
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -51,6 +53,7 @@ public class NodeModification implements StoreTreeNode<NodeModification>, Identi
 
     private final Map<PathArgument, NodeModification> childModification;
 
+    @GuardedBy("this")
     private boolean sealed = false;
 
     protected NodeModification(final PathArgument identifier, final Optional<StoreMetadataNode> original) {
@@ -173,6 +176,7 @@ public class NodeModification implements StoreTreeNode<NodeModification>, Identi
         this.value = value;
     }
 
+    @GuardedBy("this")
     private void checkSealed() {
         checkState(!sealed, "Node Modification is sealed. No further changes allowed.");
     }
@@ -202,7 +206,8 @@ public class NodeModification implements StoreTreeNode<NodeModification>, Identi
         return !childModification.isEmpty();
     }
 
-    public void updateModificationType(final ModificationType type) {
+    @GuardedBy("this")
+    private void updateModificationType(final ModificationType type) {
         modificationType = type;
         clearSnapshot();
     }