eliminate package dependency cycle
Change-Id: I7c30e5db9f5d17d24d28252b4dc58ce23835b6d8
Showing
4 changed files
with
5 additions
and
16 deletions
| ... | @@ -4,8 +4,6 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -4,8 +4,6 @@ import static com.google.common.base.Preconditions.checkNotNull; |
| 4 | 4 | ||
| 5 | import java.util.Objects; | 5 | import java.util.Objects; |
| 6 | 6 | ||
| 7 | -import org.onlab.onos.net.link.LinkDescription; | ||
| 8 | - | ||
| 9 | import com.google.common.base.MoreObjects; | 7 | import com.google.common.base.MoreObjects; |
| 10 | 8 | ||
| 11 | // TODO Consider renaming. | 9 | // TODO Consider renaming. |
| ... | @@ -69,16 +67,6 @@ public final class LinkKey { | ... | @@ -69,16 +67,6 @@ public final class LinkKey { |
| 69 | return new LinkKey(link.src(), link.dst()); | 67 | return new LinkKey(link.src(), link.dst()); |
| 70 | } | 68 | } |
| 71 | 69 | ||
| 72 | - /** | ||
| 73 | - * Creates a link identifier for the specified link. | ||
| 74 | - * | ||
| 75 | - * @param desc link description | ||
| 76 | - * @return a link identifier | ||
| 77 | - */ | ||
| 78 | - public static LinkKey linkKey(LinkDescription desc) { | ||
| 79 | - return new LinkKey(desc.src(), desc.dst()); | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | @Override | 70 | @Override |
| 83 | public int hashCode() { | 71 | public int hashCode() { |
| 84 | return Objects.hash(src(), dst); | 72 | return Objects.hash(src(), dst); | ... | ... |
| ... | @@ -238,7 +238,7 @@ public class GossipLinkStore | ... | @@ -238,7 +238,7 @@ public class GossipLinkStore |
| 238 | 238 | ||
| 239 | final Timestamped<LinkDescription> deltaDesc = new Timestamped<>(linkDescription, newTimestamp); | 239 | final Timestamped<LinkDescription> deltaDesc = new Timestamped<>(linkDescription, newTimestamp); |
| 240 | 240 | ||
| 241 | - LinkKey key = linkKey(linkDescription); | 241 | + LinkKey key = linkKey(linkDescription.src(), linkDescription.dst()); |
| 242 | final LinkEvent event; | 242 | final LinkEvent event; |
| 243 | final Timestamped<LinkDescription> mergedDesc; | 243 | final Timestamped<LinkDescription> mergedDesc; |
| 244 | synchronized (getLinkDescriptions(key)) { | 244 | synchronized (getLinkDescriptions(key)) { |
| ... | @@ -265,7 +265,8 @@ public class GossipLinkStore | ... | @@ -265,7 +265,8 @@ public class GossipLinkStore |
| 265 | ProviderId providerId, | 265 | ProviderId providerId, |
| 266 | Timestamped<LinkDescription> linkDescription) { | 266 | Timestamped<LinkDescription> linkDescription) { |
| 267 | 267 | ||
| 268 | - LinkKey key = linkKey(linkDescription.value()); | 268 | + LinkKey key = linkKey(linkDescription.value().src(), |
| 269 | + linkDescription.value().dst()); | ||
| 269 | ConcurrentMap<ProviderId, Timestamped<LinkDescription>> descs = getLinkDescriptions(key); | 270 | ConcurrentMap<ProviderId, Timestamped<LinkDescription>> descs = getLinkDescriptions(key); |
| 270 | 271 | ||
| 271 | synchronized (descs) { | 272 | synchronized (descs) { | ... | ... |
| ... | @@ -151,7 +151,7 @@ public class DistributedLinkStore | ... | @@ -151,7 +151,7 @@ public class DistributedLinkStore |
| 151 | @Override | 151 | @Override |
| 152 | public LinkEvent createOrUpdateLink(ProviderId providerId, | 152 | public LinkEvent createOrUpdateLink(ProviderId providerId, |
| 153 | LinkDescription linkDescription) { | 153 | LinkDescription linkDescription) { |
| 154 | - LinkKey key = linkKey(linkDescription); | 154 | + LinkKey key = linkKey(linkDescription.src(), linkDescription.dst()); |
| 155 | Optional<DefaultLink> link = links.getUnchecked(key); | 155 | Optional<DefaultLink> link = links.getUnchecked(key); |
| 156 | if (!link.isPresent()) { | 156 | if (!link.isPresent()) { |
| 157 | return createLink(providerId, key, linkDescription); | 157 | return createLink(providerId, key, linkDescription); | ... | ... |
| ... | @@ -149,7 +149,7 @@ public class SimpleLinkStore | ... | @@ -149,7 +149,7 @@ public class SimpleLinkStore |
| 149 | @Override | 149 | @Override |
| 150 | public LinkEvent createOrUpdateLink(ProviderId providerId, | 150 | public LinkEvent createOrUpdateLink(ProviderId providerId, |
| 151 | LinkDescription linkDescription) { | 151 | LinkDescription linkDescription) { |
| 152 | - LinkKey key = linkKey(linkDescription); | 152 | + LinkKey key = linkKey(linkDescription.src(), linkDescription.dst()); |
| 153 | 153 | ||
| 154 | ConcurrentMap<ProviderId, LinkDescription> descs = getLinkDescriptions(key); | 154 | ConcurrentMap<ProviderId, LinkDescription> descs = getLinkDescriptions(key); |
| 155 | synchronized (descs) { | 155 | synchronized (descs) { | ... | ... |
-
Please register or login to post a comment