diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-01 05:49:27 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-01 05:49:27 -0800 |
commit | e63291850fd0795c5700e25e67e5dee89ba54c5f (patch) | |
tree | 9707289536ad95bb739c9856761ad43275e07d8c /framework/src/onos/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java | |
parent | 671823e12bc13be9a8b87a5d7de33da1bb7a44e8 (diff) |
onos commit hash c2999f30c69e50df905a9d175ef80b3f23a98514
Change-Id: I2bb8562c4942b6d6a6d60b663db2e17540477b81
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java')
-rw-r--r-- | framework/src/onos/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/framework/src/onos/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java b/framework/src/onos/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java index a76a298f..5ecdc7a2 100644 --- a/framework/src/onos/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java +++ b/framework/src/onos/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java @@ -54,6 +54,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.concurrent.ExecutorService; @@ -226,10 +227,11 @@ public class FlowObjectiveManager implements FlowObjectiveService { if (fwd.nextId() != null && flowObjectiveStore.getNextGroup(fwd.nextId()) == null) { log.trace("Queuing forwarding objective for nextId {}", fwd.nextId()); - if (pendingForwards.putIfAbsent(fwd.nextId(), - Sets.newHashSet(new PendingNext(deviceId, fwd))) != null) { - Set<PendingNext> pending = pendingForwards.get(fwd.nextId()); - pending.add(new PendingNext(deviceId, fwd)); + // TODO: change to computeIfAbsent + Set<PendingNext> pnext = pendingForwards.putIfAbsent(fwd.nextId(), + Sets.newHashSet(new PendingNext(deviceId, fwd))); + if (pnext != null) { + pnext.add(new PendingNext(deviceId, fwd)); } return true; } @@ -412,5 +414,26 @@ public class FlowObjectiveManager implements FlowObjectiveService { public ForwardingObjective forwardingObjective() { return fwd; } + + @Override + public int hashCode() { + return Objects.hash(deviceId, fwd); + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof PendingNext)) { + return false; + } + final PendingNext other = (PendingNext) obj; + if (this.deviceId.equals(other.deviceId) && + this.fwd.equals(other.fwd)) { + return true; + } + return false; + } } } |