Thomas Vachuska
Committed by Gerrit Code Review

Fixed a defect where packet requests issued from different instances resulted in…

… 'redundant' packet requests due to different order of criteria serialization.

Change-Id: Ice8a0fea11b993fd4fc50b8093e02203fd76c772
......@@ -29,16 +29,21 @@ import org.onosproject.net.flow.criteria.Criteria;
import org.onosproject.net.flow.criteria.Criterion;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
/**
* Default traffic selector implementation.
*/
public final class DefaultTrafficSelector implements TrafficSelector {
private static final Comparator<? super Criterion> TYPE_COMPARATOR =
(c1, c2) -> c1.type().compareTo(c2.type());
private final Set<Criterion> criteria;
private static final TrafficSelector EMPTY
......@@ -50,7 +55,9 @@ public final class DefaultTrafficSelector implements TrafficSelector {
* @param criteria criteria
*/
private DefaultTrafficSelector(Set<Criterion> criteria) {
this.criteria = ImmutableSet.copyOf(criteria);
TreeSet<Criterion> elements = new TreeSet<>(TYPE_COMPARATOR);
elements.addAll(criteria);
this.criteria = ImmutableSet.copyOf(elements);
}
@Override
......