X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2Ftree%2FListenerTree.java;h=ac7a31818720dcc494bfa2df714ea862bed2ba45;hp=e6221f6920152aab2d60936af78646c3dd394ea2;hb=d42dec62aa97f85b28fe48086f0ad6dcea599ffb;hpb=80aa861b74f7b0b3574f0962cdb45740ff71946c diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerTree.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerTree.java index e6221f6920..ac7a318187 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerTree.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerTree.java @@ -9,19 +9,7 @@ package org.opendaylight.controller.md.sal.dom.store.impl.tree; import com.google.common.base.Optional; import com.google.common.base.Preconditions; -import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; -import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; -import org.opendaylight.controller.md.sal.dom.store.impl.DataChangeListenerRegistration; -import org.opendaylight.yangtools.concepts.AbstractListenerRegistration; -import org.opendaylight.yangtools.concepts.Identifiable; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import javax.annotation.concurrent.GuardedBy; import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -32,6 +20,20 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import javax.annotation.concurrent.GuardedBy; + +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; +import org.opendaylight.controller.md.sal.dom.store.impl.DataChangeListenerRegistration; +import org.opendaylight.yangtools.concepts.AbstractListenerRegistration; +import org.opendaylight.yangtools.concepts.Identifiable; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * A set of listeners organized as a tree by node to which they listen. This class * allows for efficient lookup of listeners when we walk the DataTreeCandidate. @@ -62,7 +64,7 @@ public final class ListenerTree { * @param scope Scope of triggering event. * @return Listener registration */ - public >> DataChangeListenerRegistration registerDataChangeListener(final InstanceIdentifier path, + public >> DataChangeListenerRegistration registerDataChangeListener(final YangInstanceIdentifier path, final L listener, final DataChangeScope scope) { // Take the write lock @@ -70,7 +72,7 @@ public final class ListenerTree { try { Node walkNode = rootNode; - for (final PathArgument arg : path.getPath()) { + for (final PathArgument arg : path.getPathArguments()) { walkNode = walkNode.ensureChild(arg); } @@ -82,7 +84,7 @@ public final class ListenerTree { } @Override - public InstanceIdentifier getPath() { + public YangInstanceIdentifier getPath() { return path; } @@ -142,7 +144,10 @@ public final class ListenerTree { /** * A walking context, pretty much equivalent to an iterator, but it - * exposes the undelying tree structure. + * exposes the underlying tree structure. + */ + /* + * FIXME: BUG-1511: split this class out as ListenerWalker. */ public static final class Walker implements AutoCloseable { private final Lock lock; @@ -175,6 +180,9 @@ public final class ListenerTree { * only as long as the {@link org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree.Walker} instance through which it is reached remains * unclosed. */ + /* + * FIXME: BUG-1511: split this class out as ListenerNode. + */ public static final class Node implements StoreTreeNode, Identifiable { private final Collection> listeners = new ArrayList<>(); private final Map children = new HashMap<>(); @@ -249,7 +257,7 @@ public final class ListenerTree { } - private abstract static class DataChangeListenerRegistrationImpl>> extends AbstractListenerRegistration // + private abstract static class DataChangeListenerRegistrationImpl>> extends AbstractListenerRegistration // implements DataChangeListenerRegistration { public DataChangeListenerRegistrationImpl(final T listener) { super(listener);