import static com.google.common.base.Preconditions.checkState;
-import java.util.Collection;
+import java.util.List;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import org.eclipse.jdt.annotation.NonNull;
@Override
protected void notifyListener(final AbstractDOMDataTreeChangeListenerRegistration<?> registration,
- final Collection<DataTreeCandidate> changes) {
+ final List<DataTreeCandidate> changes) {
LOG.debug("Enqueueing candidates {} for registration {}", changes, registration);
notificationManager.submitNotifications(registration, changes);
}
// If we are listening on root of data tree we still get empty normalized node, root is always present,
// we should filter this out separately and notify it by 'onInitialData()' once.
// Otherwise, it is just a valid data node with empty value which also should be notified by
- // "onDataTreeChanged(Collection<DataTreeCandidate>)".
+ // "onDataTreeChanged(List<DataTreeCandidate>)".
listener.onInitialData();
return reg;
}
package org.opendaylight.mdsal.dom.spi.store;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import java.util.ArrayList;
import java.util.Collection;
import java.util.IdentityHashMap;
import java.util.List;
-import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.mdsal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
import org.opendaylight.mdsal.dom.spi.AbstractRegistrationTree;
import org.opendaylight.mdsal.dom.spi.RegistrationTreeNode;
-import org.opendaylight.mdsal.dom.spi.RegistrationTreeSnapshot;
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.tree.DataTreeCandidate;
* @param changes the list of DataTreeCandidate changes
*/
protected abstract void notifyListener(@NonNull AbstractDOMDataTreeChangeListenerRegistration<?> registration,
- @NonNull Collection<DataTreeCandidate> changes);
+ @NonNull List<DataTreeCandidate> changes);
/**
* Callback notifying the subclass that the specified registration is being
return false;
}
- try (RegistrationTreeSnapshot<AbstractDOMDataTreeChangeListenerRegistration<?>> snapshot
- = takeSnapshot()) {
+ try (var snapshot = takeSnapshot()) {
final List<PathArgument> toLookup = ImmutableList.copyOf(candidate.getRootPath().getPathArguments());
- final Multimap<AbstractDOMDataTreeChangeListenerRegistration<?>, DataTreeCandidate> listenerChanges =
+ final ListMultimap<AbstractDOMDataTreeChangeListenerRegistration<?>, DataTreeCandidate> listenerChanges =
Multimaps.newListMultimap(new IdentityHashMap<>(), ArrayList::new);
lookupAndNotify(toLookup, 0, snapshot.getRootNode(), candidate, listenerChanges);
- for (Map.Entry<AbstractDOMDataTreeChangeListenerRegistration<?>, Collection<DataTreeCandidate>> entry:
- listenerChanges.asMap().entrySet()) {
+ for (var entry : Multimaps.asMap(listenerChanges).entrySet()) {
notifyListener(entry.getKey(), entry.getValue());
}
import static org.mockito.Mockito.mock;
import com.google.common.collect.ImmutableList;
-import java.util.Collection;
+import java.util.List;
import org.junit.Test;
import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.mdsal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
@Override
protected void notifyListener(final AbstractDOMDataTreeChangeListenerRegistration<?> registration,
- final Collection<DataTreeCandidate> changes) {
+ final List<DataTreeCandidate> changes) {
notifyInvoked = true;
}