Use a static YangInstanceIdentifier in AbstractEntityOwnerChangeListener 13/36813/3
authorRobert Varga <rovarga@cisco.com>
Tue, 29 Mar 2016 12:35:47 +0000 (14:35 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Wed, 30 Mar 2016 09:14:40 +0000 (09:14 +0000)
This will force reuse of the same YangInstanceIdentifier across instances.

Change-Id: Iec33a79267e059ee7fad694a50f74dc2de87035b
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractEntityOwnerChangeListener.java

index b57f3c3..eeda4f9 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.cluster.datastore.entityownership;
 
 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
 package org.opendaylight.controller.cluster.datastore.entityownership;
 
 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNERS_PATH;
+import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_OWNER_QNAME;
 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_QNAME;
 import org.opendaylight.controller.cluster.datastore.ShardDataTree;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.ENTITY_QNAME;
 import org.opendaylight.controller.cluster.datastore.ShardDataTree;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
@@ -16,11 +17,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 
-public abstract class AbstractEntityOwnerChangeListener  implements DOMDataTreeChangeListener {
+public abstract class AbstractEntityOwnerChangeListener implements DOMDataTreeChangeListener {
+    private static final YangInstanceIdentifier EOS_PATH = YangInstanceIdentifier.builder(ENTITY_OWNERS_PATH)
+            .node(EntityType.QNAME).node(EntityType.QNAME).node(ENTITY_QNAME).node(ENTITY_QNAME)
+            .node(ENTITY_OWNER_QNAME).build();
 
     void init(ShardDataTree shardDataTree) {
 
     void init(ShardDataTree shardDataTree) {
-        shardDataTree.registerTreeChangeListener(YangInstanceIdentifier.builder(ENTITY_OWNERS_PATH).
-                node(EntityType.QNAME).node(EntityType.QNAME).node(ENTITY_QNAME).node(ENTITY_QNAME).node(EntityOwnersModel.ENTITY_OWNER_QNAME).build(), this);
+        shardDataTree.registerTreeChangeListener(EOS_PATH, this);
     }
 
     protected static String extractOwner(LeafNode<?> ownerLeaf) {
     }
 
     protected static String extractOwner(LeafNode<?> ownerLeaf) {