blob: ada3b69b687675928920222309e48dd39788ecfd [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.store.link.impl;
Madan Jampani2ff05592014-10-10 15:42:47 -070017
Jonathan Hart7d656f42015-01-27 14:07:23 -080018import com.google.common.base.Function;
19import com.google.common.collect.FluentIterable;
20import com.google.common.collect.ImmutableList;
21import com.google.common.collect.Multimaps;
22import com.google.common.collect.SetMultimap;
23import com.google.common.collect.Sets;
Madan Jampania97e8202014-10-10 17:01:33 -070024import org.apache.commons.lang3.RandomUtils;
Madan Jampani2ff05592014-10-10 15:42:47 -070025import org.apache.felix.scr.annotations.Activate;
26import org.apache.felix.scr.annotations.Component;
27import org.apache.felix.scr.annotations.Deactivate;
28import org.apache.felix.scr.annotations.Reference;
29import org.apache.felix.scr.annotations.ReferenceCardinality;
30import org.apache.felix.scr.annotations.Service;
Ray Milkey7bbeb3f2014-12-11 14:59:26 -080031import org.onlab.util.KryoNamespace;
Brian O'Connorabafb502014-12-02 22:26:20 -080032import org.onosproject.cluster.ClusterService;
33import org.onosproject.cluster.ControllerNode;
34import org.onosproject.cluster.NodeId;
Marc De Leenheerb473b9d2015-02-06 15:21:03 -080035import org.onosproject.mastership.MastershipService;
Brian O'Connorabafb502014-12-02 22:26:20 -080036import org.onosproject.net.AnnotationKeys;
37import org.onosproject.net.AnnotationsUtil;
38import org.onosproject.net.ConnectPoint;
39import org.onosproject.net.DefaultAnnotations;
40import org.onosproject.net.DefaultLink;
41import org.onosproject.net.DeviceId;
42import org.onosproject.net.Link;
43import org.onosproject.net.Link.Type;
44import org.onosproject.net.LinkKey;
45import org.onosproject.net.SparseAnnotations;
46import org.onosproject.net.device.DeviceClockService;
47import org.onosproject.net.link.DefaultLinkDescription;
48import org.onosproject.net.link.LinkDescription;
49import org.onosproject.net.link.LinkEvent;
50import org.onosproject.net.link.LinkStore;
51import org.onosproject.net.link.LinkStoreDelegate;
52import org.onosproject.net.provider.ProviderId;
53import org.onosproject.store.AbstractStore;
54import org.onosproject.store.Timestamp;
55import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
56import org.onosproject.store.cluster.messaging.ClusterMessage;
57import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
58import org.onosproject.store.cluster.messaging.MessageSubject;
59import org.onosproject.store.impl.Timestamped;
60import org.onosproject.store.serializers.KryoSerializer;
61import org.onosproject.store.serializers.impl.DistributedStoreSerializers;
Madan Jampani2ff05592014-10-10 15:42:47 -070062import org.slf4j.Logger;
63
Jonathan Hart7d656f42015-01-27 14:07:23 -080064import java.io.IOException;
65import java.util.Collection;
66import java.util.Collections;
67import java.util.HashMap;
68import java.util.HashSet;
69import java.util.Map;
70import java.util.Map.Entry;
71import java.util.Objects;
72import java.util.Set;
73import java.util.concurrent.ConcurrentHashMap;
74import java.util.concurrent.ConcurrentMap;
75import java.util.concurrent.ExecutorService;
76import java.util.concurrent.Executors;
77import java.util.concurrent.ScheduledExecutorService;
78import java.util.concurrent.TimeUnit;
Madan Jampani2ff05592014-10-10 15:42:47 -070079
Thomas Vachuska57126fe2014-11-11 17:13:24 -080080import static com.google.common.base.Preconditions.checkNotNull;
81import static com.google.common.base.Predicates.notNull;
82import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
Madan Jampania97e8202014-10-10 17:01:33 -070083import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
Thomas Vachuska6f94ded2015-02-21 14:02:38 -080084import static org.onlab.util.Tools.groupedThreads;
Ray Milkey7bbeb3f2014-12-11 14:59:26 -080085import static org.onlab.util.Tools.minPriority;
Brian O'Connorabafb502014-12-02 22:26:20 -080086import static org.onosproject.cluster.ControllerNodeToNodeId.toNodeId;
87import static org.onosproject.net.DefaultAnnotations.merge;
88import static org.onosproject.net.DefaultAnnotations.union;
89import static org.onosproject.net.Link.State.ACTIVE;
90import static org.onosproject.net.Link.State.INACTIVE;
91import static org.onosproject.net.Link.Type.DIRECT;
92import static org.onosproject.net.Link.Type.INDIRECT;
93import static org.onosproject.net.LinkKey.linkKey;
Marc De Leenheerb473b9d2015-02-06 15:21:03 -080094import static org.onosproject.net.link.LinkEvent.Type.*;
Brian O'Connorabafb502014-12-02 22:26:20 -080095import static org.onosproject.store.link.impl.GossipLinkStoreMessageSubjects.LINK_ANTI_ENTROPY_ADVERTISEMENT;
Madan Jampani2ff05592014-10-10 15:42:47 -070096import static org.slf4j.LoggerFactory.getLogger;
Madan Jampani2ff05592014-10-10 15:42:47 -070097
98/**
99 * Manages inventory of infrastructure links in distributed data store
100 * that uses optimistic replication and gossip based techniques.
101 */
102@Component(immediate = true)
103@Service
104public class GossipLinkStore
105 extends AbstractStore<LinkEvent, LinkStoreDelegate>
106 implements LinkStore {
107
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800108 // Timeout in milliseconds to process links on remote master node
109 private static final int REMOTE_MASTER_TIMEOUT = 1000;
110
Madan Jampani2ff05592014-10-10 15:42:47 -0700111 private final Logger log = getLogger(getClass());
112
113 // Link inventory
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700114 private final ConcurrentMap<LinkKey, Map<ProviderId, Timestamped<LinkDescription>>> linkDescs =
Madan Jampani2ff05592014-10-10 15:42:47 -0700115 new ConcurrentHashMap<>();
116
117 // Link instance cache
118 private final ConcurrentMap<LinkKey, Link> links = new ConcurrentHashMap<>();
119
120 // Egress and ingress link sets
121 private final SetMultimap<DeviceId, LinkKey> srcLinks = createSynchronizedHashMultiMap();
122 private final SetMultimap<DeviceId, LinkKey> dstLinks = createSynchronizedHashMultiMap();
123
124 // Remove links
Yuta HIGUCHIb9125562014-12-01 23:28:22 -0800125 private final Map<LinkKey, Timestamp> removedLinks = new ConcurrentHashMap<>();
Madan Jampani2ff05592014-10-10 15:42:47 -0700126
127 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
Yuta HIGUCHI093e83e2014-10-10 22:26:11 -0700128 protected DeviceClockService deviceClockService;
Madan Jampani2ff05592014-10-10 15:42:47 -0700129
130 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
131 protected ClusterCommunicationService clusterCommunicator;
132
133 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
134 protected ClusterService clusterService;
135
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800136 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
137 protected MastershipService mastershipService;
138
Yuta HIGUCHI3e5d11a2014-11-04 14:16:44 -0800139 protected static final KryoSerializer SERIALIZER = new KryoSerializer() {
Madan Jampani2ff05592014-10-10 15:42:47 -0700140 @Override
141 protected void setupKryoPool() {
Yuta HIGUCHI8d143d22014-10-19 23:15:09 -0700142 serializerPool = KryoNamespace.newBuilder()
Yuta HIGUCHI91768e32014-11-22 05:06:35 -0800143 .register(DistributedStoreSerializers.STORE_COMMON)
144 .nextId(DistributedStoreSerializers.STORE_CUSTOM_BEGIN)
Madan Jampani2ff05592014-10-10 15:42:47 -0700145 .register(InternalLinkEvent.class)
146 .register(InternalLinkRemovedEvent.class)
Madan Jampanid2054d42014-10-10 17:27:06 -0700147 .register(LinkAntiEntropyAdvertisement.class)
148 .register(LinkFragmentId.class)
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800149 .register(LinkInjectedEvent.class)
Yuta HIGUCHI91768e32014-11-22 05:06:35 -0800150 .build();
Madan Jampani2ff05592014-10-10 15:42:47 -0700151 }
152 };
153
Yuta HIGUCHI80d56592014-11-25 15:11:13 -0800154 private ExecutorService executor;
155
Yuta HIGUCHI06586272014-11-25 14:27:03 -0800156 private ScheduledExecutorService backgroundExecutors;
Madan Jampania97e8202014-10-10 17:01:33 -0700157
Madan Jampani2ff05592014-10-10 15:42:47 -0700158 @Activate
159 public void activate() {
160
Thomas Vachuska6f94ded2015-02-21 14:02:38 -0800161 executor = Executors.newCachedThreadPool(groupedThreads("onos/link", "fg-%d"));
Yuta HIGUCHI80d56592014-11-25 15:11:13 -0800162
Yuta HIGUCHI06586272014-11-25 14:27:03 -0800163 backgroundExecutors =
Thomas Vachuska6f94ded2015-02-21 14:02:38 -0800164 newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/link", "bg-%d")));
Madan Jampania97e8202014-10-10 17:01:33 -0700165
Madan Jampani2af244a2015-02-22 13:12:01 -0800166 clusterCommunicator.addSubscriber(
167 GossipLinkStoreMessageSubjects.LINK_UPDATE,
168 new InternalLinkEventListener(), executor);
169 clusterCommunicator.addSubscriber(
170 GossipLinkStoreMessageSubjects.LINK_REMOVED,
171 new InternalLinkRemovedEventListener(), executor);
172 clusterCommunicator.addSubscriber(
173 GossipLinkStoreMessageSubjects.LINK_ANTI_ENTROPY_ADVERTISEMENT,
174 new InternalLinkAntiEntropyAdvertisementListener(), backgroundExecutors);
175 clusterCommunicator.addSubscriber(
176 GossipLinkStoreMessageSubjects.LINK_INJECTED,
177 new LinkInjectedEventListener(), executor);
178
Madan Jampania97e8202014-10-10 17:01:33 -0700179 long initialDelaySec = 5;
180 long periodSec = 5;
181 // start anti-entropy thread
Yuta HIGUCHI06586272014-11-25 14:27:03 -0800182 backgroundExecutors.scheduleAtFixedRate(new SendAdvertisementTask(),
Madan Jampania97e8202014-10-10 17:01:33 -0700183 initialDelaySec, periodSec, TimeUnit.SECONDS);
Madan Jampani2ff05592014-10-10 15:42:47 -0700184
185 log.info("Started");
186 }
187
188 @Deactivate
189 public void deactivate() {
Madan Jampani3ffbb272014-10-13 11:19:37 -0700190
Yuta HIGUCHI80d56592014-11-25 15:11:13 -0800191 executor.shutdownNow();
192
Yuta HIGUCHI06586272014-11-25 14:27:03 -0800193 backgroundExecutors.shutdownNow();
Madan Jampani3ffbb272014-10-13 11:19:37 -0700194 try {
Yuta HIGUCHI06586272014-11-25 14:27:03 -0800195 if (!backgroundExecutors.awaitTermination(5, TimeUnit.SECONDS)) {
Madan Jampani3ffbb272014-10-13 11:19:37 -0700196 log.error("Timeout during executor shutdown");
197 }
198 } catch (InterruptedException e) {
199 log.error("Error during executor shutdown", e);
200 }
201
Madan Jampani2ff05592014-10-10 15:42:47 -0700202 linkDescs.clear();
203 links.clear();
204 srcLinks.clear();
205 dstLinks.clear();
206 log.info("Stopped");
207 }
208
209 @Override
210 public int getLinkCount() {
211 return links.size();
212 }
213
214 @Override
215 public Iterable<Link> getLinks() {
216 return Collections.unmodifiableCollection(links.values());
217 }
218
219 @Override
220 public Set<Link> getDeviceEgressLinks(DeviceId deviceId) {
221 // lock for iteration
222 synchronized (srcLinks) {
223 return FluentIterable.from(srcLinks.get(deviceId))
224 .transform(lookupLink())
225 .filter(notNull())
226 .toSet();
227 }
228 }
229
230 @Override
231 public Set<Link> getDeviceIngressLinks(DeviceId deviceId) {
232 // lock for iteration
233 synchronized (dstLinks) {
234 return FluentIterable.from(dstLinks.get(deviceId))
235 .transform(lookupLink())
236 .filter(notNull())
237 .toSet();
238 }
239 }
240
241 @Override
242 public Link getLink(ConnectPoint src, ConnectPoint dst) {
Yuta HIGUCHI18ab8a92014-10-13 11:16:19 -0700243 return links.get(linkKey(src, dst));
Madan Jampani2ff05592014-10-10 15:42:47 -0700244 }
245
246 @Override
247 public Set<Link> getEgressLinks(ConnectPoint src) {
248 Set<Link> egress = new HashSet<>();
249 for (LinkKey linkKey : srcLinks.get(src.deviceId())) {
250 if (linkKey.src().equals(src)) {
Ray Milkey7bbeb3f2014-12-11 14:59:26 -0800251 Link link = links.get(linkKey);
252 if (link != null) {
253 egress.add(link);
254 } else {
255 log.debug("Egress link for {} was null, skipped", linkKey);
256 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700257 }
258 }
259 return egress;
260 }
261
262 @Override
263 public Set<Link> getIngressLinks(ConnectPoint dst) {
264 Set<Link> ingress = new HashSet<>();
265 for (LinkKey linkKey : dstLinks.get(dst.deviceId())) {
266 if (linkKey.dst().equals(dst)) {
Ray Milkey7bbeb3f2014-12-11 14:59:26 -0800267 Link link = links.get(linkKey);
268 if (link != null) {
269 ingress.add(link);
270 } else {
271 log.debug("Ingress link for {} was null, skipped", linkKey);
272 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700273 }
274 }
275 return ingress;
276 }
277
278 @Override
279 public LinkEvent createOrUpdateLink(ProviderId providerId,
280 LinkDescription linkDescription) {
281
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800282 final DeviceId dstDeviceId = linkDescription.dst().deviceId();
283 final NodeId localNode = clusterService.getLocalNode().id();
284 final NodeId dstNode = mastershipService.getMasterFor(dstDeviceId);
Madan Jampani2ff05592014-10-10 15:42:47 -0700285
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800286 // Process link update only if we're the master of the destination node,
287 // otherwise signal the actual master.
288 LinkEvent linkEvent = null;
289 if (localNode.equals(dstNode)) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700290
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800291 Timestamp newTimestamp = deviceClockService.getTimestamp(dstDeviceId);
292
293 final Timestamped<LinkDescription> deltaDesc = new Timestamped<>(linkDescription, newTimestamp);
294
295 LinkKey key = linkKey(linkDescription.src(), linkDescription.dst());
296 final Timestamped<LinkDescription> mergedDesc;
297 Map<ProviderId, Timestamped<LinkDescription>> map = getOrCreateLinkDescriptions(key);
298
299 synchronized (map) {
300 linkEvent = createOrUpdateLinkInternal(providerId, deltaDesc);
301 mergedDesc = map.get(providerId);
302 }
303
304 if (linkEvent != null) {
305 log.info("Notifying peers of a link update topology event from providerId: "
306 + "{} between src: {} and dst: {}",
307 providerId, linkDescription.src(), linkDescription.dst());
308 notifyPeers(new InternalLinkEvent(providerId, mergedDesc));
309 }
310
311 } else {
HIGUCHI Yutadc2e7c22015-02-24 12:19:47 -0800312 // FIXME Temporary hack for NPE (ONOS-1171).
313 // Proper fix is to implement forwarding to master on ConfigProvider
314 // redo ONOS-490
315 if (dstNode == null) {
316 // silently ignore
317 return null;
318 }
319
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800320
321 LinkInjectedEvent linkInjectedEvent = new LinkInjectedEvent(providerId, linkDescription);
322 ClusterMessage linkInjectedMessage = new ClusterMessage(localNode,
323 GossipLinkStoreMessageSubjects.LINK_INJECTED, SERIALIZER.encode(linkInjectedEvent));
324
325 try {
326 clusterCommunicator.unicast(linkInjectedMessage, dstNode);
327 } catch (IOException e) {
328 log.warn("Failed to process link update between src: {} and dst: {} " +
329 "(cluster messaging failed: {})",
330 linkDescription.src(), linkDescription.dst(), e);
331 }
332
Yuta HIGUCHI92cd51e2014-10-13 10:51:45 -0700333 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700334
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800335 return linkEvent;
Madan Jampani2ff05592014-10-10 15:42:47 -0700336 }
337
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800338 @Override
339 public LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst) {
340 Link link = getLink(src, dst);
341 if (link == null) {
342 return null;
343 }
344
345 if (link.isDurable()) {
346 // FIXME: this is not the right thing to call for the gossip store; will not sync link state!!!
347 return link.state() == INACTIVE ? null :
348 updateLink(linkKey(link.src(), link.dst()), link,
349 new DefaultLink(link.providerId(),
350 link.src(), link.dst(),
351 link.type(), INACTIVE,
352 link.isDurable(),
353 link.annotations()));
354 }
355 return removeLink(src, dst);
356 }
357
Madan Jampani2ff05592014-10-10 15:42:47 -0700358 private LinkEvent createOrUpdateLinkInternal(
359 ProviderId providerId,
360 Timestamped<LinkDescription> linkDescription) {
361
Yuta HIGUCHIa85542b2014-10-21 19:29:49 -0700362 final LinkKey key = linkKey(linkDescription.value().src(),
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800363 linkDescription.value().dst());
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700364 Map<ProviderId, Timestamped<LinkDescription>> descs = getOrCreateLinkDescriptions(key);
Madan Jampani2ff05592014-10-10 15:42:47 -0700365
366 synchronized (descs) {
367 // if the link was previously removed, we should proceed if and
368 // only if this request is more recent.
369 Timestamp linkRemovedTimestamp = removedLinks.get(key);
370 if (linkRemovedTimestamp != null) {
Jonathan Hart403ea932015-02-20 16:23:00 -0800371 if (linkDescription.isNewerThan(linkRemovedTimestamp)) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700372 removedLinks.remove(key);
373 } else {
Yuta HIGUCHIa85542b2014-10-21 19:29:49 -0700374 log.trace("Link {} was already removed ignoring.", key);
Madan Jampani2ff05592014-10-10 15:42:47 -0700375 return null;
376 }
377 }
378
379 final Link oldLink = links.get(key);
380 // update description
381 createOrUpdateLinkDescription(descs, providerId, linkDescription);
382 final Link newLink = composeLink(descs);
383 if (oldLink == null) {
384 return createLink(key, newLink);
385 }
386 return updateLink(key, oldLink, newLink);
387 }
388 }
389
390 // Guarded by linkDescs value (=locking each Link)
391 private Timestamped<LinkDescription> createOrUpdateLinkDescription(
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700392 Map<ProviderId, Timestamped<LinkDescription>> descs,
Madan Jampani2ff05592014-10-10 15:42:47 -0700393 ProviderId providerId,
394 Timestamped<LinkDescription> linkDescription) {
395
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700396 // merge existing annotations
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700397 Timestamped<LinkDescription> existingLinkDescription = descs.get(providerId);
Madan Jampani2ff05592014-10-10 15:42:47 -0700398 if (existingLinkDescription != null && existingLinkDescription.isNewer(linkDescription)) {
Yuta HIGUCHIa85542b2014-10-21 19:29:49 -0700399 log.trace("local info is more up-to-date, ignoring {}.", linkDescription);
Madan Jampani2ff05592014-10-10 15:42:47 -0700400 return null;
401 }
402 Timestamped<LinkDescription> newLinkDescription = linkDescription;
403 if (existingLinkDescription != null) {
Yuta HIGUCHIa85542b2014-10-21 19:29:49 -0700404 // we only allow transition from INDIRECT -> DIRECT
405 final Type newType;
406 if (existingLinkDescription.value().type() == DIRECT) {
407 newType = DIRECT;
408 } else {
409 newType = linkDescription.value().type();
410 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700411 SparseAnnotations merged = union(existingLinkDescription.value().annotations(),
412 linkDescription.value().annotations());
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800413 newLinkDescription = new Timestamped<>(
Madan Jampani2ff05592014-10-10 15:42:47 -0700414 new DefaultLinkDescription(
415 linkDescription.value().src(),
416 linkDescription.value().dst(),
Yuta HIGUCHIa85542b2014-10-21 19:29:49 -0700417 newType, merged),
Madan Jampani2ff05592014-10-10 15:42:47 -0700418 linkDescription.timestamp());
419 }
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700420 return descs.put(providerId, newLinkDescription);
Madan Jampani2ff05592014-10-10 15:42:47 -0700421 }
422
423 // Creates and stores the link and returns the appropriate event.
424 // Guarded by linkDescs value (=locking each Link)
425 private LinkEvent createLink(LinkKey key, Link newLink) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700426 links.put(key, newLink);
427 srcLinks.put(newLink.src().deviceId(), key);
428 dstLinks.put(newLink.dst().deviceId(), key);
429 return new LinkEvent(LINK_ADDED, newLink);
430 }
431
432 // Updates, if necessary the specified link and returns the appropriate event.
433 // Guarded by linkDescs value (=locking each Link)
434 private LinkEvent updateLink(LinkKey key, Link oldLink, Link newLink) {
Yuta HIGUCHIa85542b2014-10-21 19:29:49 -0700435 // Note: INDIRECT -> DIRECT transition only
436 // so that BDDP discovered Link will not overwrite LDDP Link
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800437 if (oldLink.state() != newLink.state() ||
438 (oldLink.type() == INDIRECT && newLink.type() == DIRECT) ||
Madan Jampani2ff05592014-10-10 15:42:47 -0700439 !AnnotationsUtil.isEqual(oldLink.annotations(), newLink.annotations())) {
440
441 links.put(key, newLink);
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800442 // strictly speaking following can be omitted
Madan Jampani2ff05592014-10-10 15:42:47 -0700443 srcLinks.put(oldLink.src().deviceId(), key);
444 dstLinks.put(oldLink.dst().deviceId(), key);
445 return new LinkEvent(LINK_UPDATED, newLink);
446 }
447 return null;
448 }
449
450 @Override
451 public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) {
Yuta HIGUCHI18ab8a92014-10-13 11:16:19 -0700452 final LinkKey key = linkKey(src, dst);
Madan Jampani2ff05592014-10-10 15:42:47 -0700453
454 DeviceId dstDeviceId = dst.deviceId();
Ayaka Koshibeb5c63a02014-10-18 18:42:27 -0700455 Timestamp timestamp = null;
456 try {
457 timestamp = deviceClockService.getTimestamp(dstDeviceId);
458 } catch (IllegalStateException e) {
Yuta HIGUCHId6a0ac32014-11-04 09:26:31 -0800459 log.warn("Failed to remove link {}, was not the master", key);
Ayaka Koshibeb5c63a02014-10-18 18:42:27 -0700460 //there are times when this is called before mastership
461 // handoff correctly completes.
462 return null;
463 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700464
465 LinkEvent event = removeLinkInternal(key, timestamp);
466
467 if (event != null) {
468 log.info("Notifying peers of a link removed topology event for a link "
469 + "between src: {} and dst: {}", src, dst);
Jonathan Hart7d656f42015-01-27 14:07:23 -0800470 notifyPeers(new InternalLinkRemovedEvent(key, timestamp));
Madan Jampani2ff05592014-10-10 15:42:47 -0700471 }
472 return event;
473 }
474
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700475 private static Timestamped<LinkDescription> getPrimaryDescription(
476 Map<ProviderId, Timestamped<LinkDescription>> linkDescriptions) {
477
Madan Jampani2ff05592014-10-10 15:42:47 -0700478 synchronized (linkDescriptions) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700479 for (Entry<ProviderId, Timestamped<LinkDescription>>
480 e : linkDescriptions.entrySet()) {
481
482 if (!e.getKey().isAncillary()) {
483 return e.getValue();
484 }
485 }
486 }
487 return null;
488 }
489
490
491 // TODO: consider slicing out as Timestamp utils
492 /**
493 * Checks is timestamp is more recent than timestamped object.
494 *
495 * @param timestamp to check if this is more recent then other
496 * @param timestamped object to be tested against
497 * @return true if {@code timestamp} is more recent than {@code timestamped}
498 * or {@code timestamped is null}
499 */
500 private static boolean isMoreRecent(Timestamp timestamp, Timestamped<?> timestamped) {
501 checkNotNull(timestamp);
502 if (timestamped == null) {
503 return true;
504 }
505 return timestamp.compareTo(timestamped.timestamp()) > 0;
506 }
507
508 private LinkEvent removeLinkInternal(LinkKey key, Timestamp timestamp) {
509 Map<ProviderId, Timestamped<LinkDescription>> linkDescriptions
510 = getOrCreateLinkDescriptions(key);
511
512 synchronized (linkDescriptions) {
513 if (linkDescriptions.isEmpty()) {
514 // never seen such link before. keeping timestamp for record
515 removedLinks.put(key, timestamp);
516 return null;
517 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700518 // accept removal request if given timestamp is newer than
519 // the latest Timestamp from Primary provider
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700520 Timestamped<LinkDescription> prim = getPrimaryDescription(linkDescriptions);
521 if (!isMoreRecent(timestamp, prim)) {
522 // outdated remove request, ignore
Madan Jampani2ff05592014-10-10 15:42:47 -0700523 return null;
524 }
525 removedLinks.put(key, timestamp);
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800526 Link link = links.remove(key);
Madan Jampani2ff05592014-10-10 15:42:47 -0700527 linkDescriptions.clear();
528 if (link != null) {
529 srcLinks.remove(link.src().deviceId(), key);
530 dstLinks.remove(link.dst().deviceId(), key);
531 return new LinkEvent(LINK_REMOVED, link);
532 }
533 return null;
534 }
535 }
536
Yuta HIGUCHI800fac62014-12-11 19:23:01 -0800537 /**
538 * Creates concurrent readable, synchronized HashMultimap.
539 *
540 * @return SetMultimap
541 */
Madan Jampani2ff05592014-10-10 15:42:47 -0700542 private static <K, V> SetMultimap<K, V> createSynchronizedHashMultiMap() {
Yuta HIGUCHI800fac62014-12-11 19:23:01 -0800543 return synchronizedSetMultimap(
544 Multimaps.newSetMultimap(new ConcurrentHashMap<K, Collection<V>>(),
545 () -> Sets.newConcurrentHashSet()));
Madan Jampani2ff05592014-10-10 15:42:47 -0700546 }
547
548 /**
549 * @return primary ProviderID, or randomly chosen one if none exists
550 */
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700551 private static ProviderId pickBaseProviderId(
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700552 Map<ProviderId, Timestamped<LinkDescription>> linkDescriptions) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700553
554 ProviderId fallBackPrimary = null;
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700555 for (Entry<ProviderId, Timestamped<LinkDescription>> e : linkDescriptions.entrySet()) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700556 if (!e.getKey().isAncillary()) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700557 // found primary
Madan Jampani2ff05592014-10-10 15:42:47 -0700558 return e.getKey();
559 } else if (fallBackPrimary == null) {
560 // pick randomly as a fallback in case there is no primary
561 fallBackPrimary = e.getKey();
562 }
563 }
564 return fallBackPrimary;
565 }
566
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700567 // Guarded by linkDescs value (=locking each Link)
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700568 private Link composeLink(Map<ProviderId, Timestamped<LinkDescription>> descs) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700569 ProviderId baseProviderId = pickBaseProviderId(descs);
570 Timestamped<LinkDescription> base = descs.get(baseProviderId);
Madan Jampani2ff05592014-10-10 15:42:47 -0700571
572 ConnectPoint src = base.value().src();
573 ConnectPoint dst = base.value().dst();
574 Type type = base.value().type();
575 DefaultAnnotations annotations = DefaultAnnotations.builder().build();
576 annotations = merge(annotations, base.value().annotations());
577
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700578 for (Entry<ProviderId, Timestamped<LinkDescription>> e : descs.entrySet()) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700579 if (baseProviderId.equals(e.getKey())) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700580 continue;
581 }
582
Yuta HIGUCHI65934892014-12-04 17:47:44 -0800583 // Note: In the long run we should keep track of Description timestamp
Madan Jampani2ff05592014-10-10 15:42:47 -0700584 // and only merge conflicting keys when timestamp is newer
585 // Currently assuming there will never be a key conflict between
586 // providers
587
588 // annotation merging. not so efficient, should revisit later
589 annotations = merge(annotations, e.getValue().value().annotations());
590 }
591
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800592 boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true");
Thomas Vachuskabadb93f2014-11-15 23:51:17 -0800593 return new DefaultLink(baseProviderId, src, dst, type, ACTIVE, isDurable, annotations);
Madan Jampani2ff05592014-10-10 15:42:47 -0700594 }
595
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700596 private Map<ProviderId, Timestamped<LinkDescription>> getOrCreateLinkDescriptions(LinkKey key) {
Yuta HIGUCHI3e1a5bf2014-10-14 19:39:58 -0700597 Map<ProviderId, Timestamped<LinkDescription>> r;
598 r = linkDescs.get(key);
599 if (r != null) {
600 return r;
601 }
602 r = new HashMap<>();
603 final Map<ProviderId, Timestamped<LinkDescription>> concurrentlyAdded;
604 concurrentlyAdded = linkDescs.putIfAbsent(key, r);
605 if (concurrentlyAdded != null) {
606 return concurrentlyAdded;
607 } else {
608 return r;
609 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700610 }
611
612 private final Function<LinkKey, Link> lookupLink = new LookupLink();
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800613
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700614 /**
615 * Returns a Function to lookup Link instance using LinkKey from cache.
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800616 *
617 * @return lookup link function
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700618 */
Madan Jampani2ff05592014-10-10 15:42:47 -0700619 private Function<LinkKey, Link> lookupLink() {
620 return lookupLink;
621 }
622
623 private final class LookupLink implements Function<LinkKey, Link> {
624 @Override
625 public Link apply(LinkKey input) {
Yuta HIGUCHI023295a2014-10-15 23:29:46 -0700626 if (input == null) {
627 return null;
628 } else {
629 return links.get(input);
630 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700631 }
632 }
633
Madan Jampani2ff05592014-10-10 15:42:47 -0700634 private void notifyDelegateIfNotNull(LinkEvent event) {
635 if (event != null) {
636 notifyDelegate(event);
637 }
638 }
639
Jonathan Hart7d656f42015-01-27 14:07:23 -0800640 private void broadcastMessage(MessageSubject subject, Object event) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700641 ClusterMessage message = new ClusterMessage(
642 clusterService.getLocalNode().id(),
643 subject,
644 SERIALIZER.encode(event));
645 clusterCommunicator.broadcast(message);
646 }
647
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700648 private void unicastMessage(NodeId recipient, MessageSubject subject, Object event) throws IOException {
649 ClusterMessage message = new ClusterMessage(
650 clusterService.getLocalNode().id(),
651 subject,
652 SERIALIZER.encode(event));
653 clusterCommunicator.unicast(message, recipient);
Madan Jampania97e8202014-10-10 17:01:33 -0700654 }
655
Jonathan Hart7d656f42015-01-27 14:07:23 -0800656 private void notifyPeers(InternalLinkEvent event) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700657 broadcastMessage(GossipLinkStoreMessageSubjects.LINK_UPDATE, event);
658 }
659
Jonathan Hart7d656f42015-01-27 14:07:23 -0800660 private void notifyPeers(InternalLinkRemovedEvent event) {
Madan Jampani2ff05592014-10-10 15:42:47 -0700661 broadcastMessage(GossipLinkStoreMessageSubjects.LINK_REMOVED, event);
662 }
663
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700664 // notify peer, silently ignoring error
Madan Jampania97e8202014-10-10 17:01:33 -0700665 private void notifyPeer(NodeId peer, InternalLinkEvent event) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700666 try {
667 unicastMessage(peer, GossipLinkStoreMessageSubjects.LINK_UPDATE, event);
668 } catch (IOException e) {
669 log.debug("Failed to notify peer {} with message {}", peer, event);
670 }
Madan Jampania97e8202014-10-10 17:01:33 -0700671 }
672
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700673 // notify peer, silently ignoring error
Madan Jampania97e8202014-10-10 17:01:33 -0700674 private void notifyPeer(NodeId peer, InternalLinkRemovedEvent event) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700675 try {
676 unicastMessage(peer, GossipLinkStoreMessageSubjects.LINK_REMOVED, event);
677 } catch (IOException e) {
678 log.debug("Failed to notify peer {} with message {}", peer, event);
679 }
Madan Jampania97e8202014-10-10 17:01:33 -0700680 }
681
682 private final class SendAdvertisementTask implements Runnable {
683
684 @Override
685 public void run() {
686 if (Thread.currentThread().isInterrupted()) {
Yuta HIGUCHI1a012722014-11-20 15:21:41 -0800687 log.debug("Interrupted, quitting");
Madan Jampania97e8202014-10-10 17:01:33 -0700688 return;
689 }
690
691 try {
692 final NodeId self = clusterService.getLocalNode().id();
693 Set<ControllerNode> nodes = clusterService.getNodes();
694
695 ImmutableList<NodeId> nodeIds = FluentIterable.from(nodes)
696 .transform(toNodeId())
697 .toList();
698
699 if (nodeIds.size() == 1 && nodeIds.get(0).equals(self)) {
Yuta HIGUCHIfaf9e1c2014-11-20 00:31:29 -0800700 log.trace("No other peers in the cluster.");
Madan Jampania97e8202014-10-10 17:01:33 -0700701 return;
702 }
703
704 NodeId peer;
705 do {
706 int idx = RandomUtils.nextInt(0, nodeIds.size());
707 peer = nodeIds.get(idx);
708 } while (peer.equals(self));
709
710 LinkAntiEntropyAdvertisement ad = createAdvertisement();
711
712 if (Thread.currentThread().isInterrupted()) {
Yuta HIGUCHI1a012722014-11-20 15:21:41 -0800713 log.debug("Interrupted, quitting");
Madan Jampania97e8202014-10-10 17:01:33 -0700714 return;
715 }
716
717 try {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700718 unicastMessage(peer, LINK_ANTI_ENTROPY_ADVERTISEMENT, ad);
719 } catch (IOException e) {
720 log.debug("Failed to send anti-entropy advertisement to {}", peer);
Madan Jampania97e8202014-10-10 17:01:33 -0700721 return;
722 }
723 } catch (Exception e) {
724 // catch all Exception to avoid Scheduled task being suppressed.
725 log.error("Exception thrown while sending advertisement", e);
726 }
727 }
728 }
729
730 private LinkAntiEntropyAdvertisement createAdvertisement() {
731 final NodeId self = clusterService.getLocalNode().id();
732
733 Map<LinkFragmentId, Timestamp> linkTimestamps = new HashMap<>(linkDescs.size());
734 Map<LinkKey, Timestamp> linkTombstones = new HashMap<>(removedLinks.size());
735
Yuta HIGUCHIb6cfac32014-11-25 13:37:27 -0800736 linkDescs.forEach((linkKey, linkDesc) -> {
Madan Jampania97e8202014-10-10 17:01:33 -0700737 synchronized (linkDesc) {
738 for (Map.Entry<ProviderId, Timestamped<LinkDescription>> e : linkDesc.entrySet()) {
739 linkTimestamps.put(new LinkFragmentId(linkKey, e.getKey()), e.getValue().timestamp());
740 }
741 }
Yuta HIGUCHIb6cfac32014-11-25 13:37:27 -0800742 });
Madan Jampania97e8202014-10-10 17:01:33 -0700743
744 linkTombstones.putAll(removedLinks);
745
746 return new LinkAntiEntropyAdvertisement(self, linkTimestamps, linkTombstones);
747 }
748
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700749 private void handleAntiEntropyAdvertisement(LinkAntiEntropyAdvertisement ad) {
Madan Jampania97e8202014-10-10 17:01:33 -0700750
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700751 final NodeId sender = ad.sender();
752 boolean localOutdated = false;
Madan Jampania97e8202014-10-10 17:01:33 -0700753
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700754 for (Entry<LinkKey, Map<ProviderId, Timestamped<LinkDescription>>>
755 l : linkDescs.entrySet()) {
Madan Jampania97e8202014-10-10 17:01:33 -0700756
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700757 final LinkKey key = l.getKey();
758 final Map<ProviderId, Timestamped<LinkDescription>> link = l.getValue();
759 synchronized (link) {
760 Timestamp localLatest = removedLinks.get(key);
Madan Jampania97e8202014-10-10 17:01:33 -0700761
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700762 for (Entry<ProviderId, Timestamped<LinkDescription>> p : link.entrySet()) {
763 final ProviderId providerId = p.getKey();
764 final Timestamped<LinkDescription> pDesc = p.getValue();
Madan Jampania97e8202014-10-10 17:01:33 -0700765
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700766 final LinkFragmentId fragId = new LinkFragmentId(key, providerId);
767 // remote
768 Timestamp remoteTimestamp = ad.linkTimestamps().get(fragId);
769 if (remoteTimestamp == null) {
770 remoteTimestamp = ad.linkTombstones().get(key);
771 }
772 if (remoteTimestamp == null ||
Jonathan Hart403ea932015-02-20 16:23:00 -0800773 pDesc.isNewerThan(remoteTimestamp)) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700774 // I have more recent link description. update peer.
775 notifyPeer(sender, new InternalLinkEvent(providerId, pDesc));
776 } else {
777 final Timestamp remoteLive = ad.linkTimestamps().get(fragId);
778 if (remoteLive != null &&
779 remoteLive.compareTo(pDesc.timestamp()) > 0) {
780 // I have something outdated
781 localOutdated = true;
782 }
783 }
784
785 // search local latest along the way
786 if (localLatest == null ||
Jonathan Hart403ea932015-02-20 16:23:00 -0800787 pDesc.isNewerThan(localLatest)) {
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700788 localLatest = pDesc.timestamp();
789 }
790 }
791 // Tests if remote remove is more recent then local latest.
792 final Timestamp remoteRemove = ad.linkTombstones().get(key);
793 if (remoteRemove != null) {
794 if (localLatest != null &&
795 localLatest.compareTo(remoteRemove) < 0) {
796 // remote remove is more recent
797 notifyDelegateIfNotNull(removeLinkInternal(key, remoteRemove));
798 }
799 }
Madan Jampania97e8202014-10-10 17:01:33 -0700800 }
801 }
802
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700803 // populate remove info if not known locally
804 for (Entry<LinkKey, Timestamp> remoteRm : ad.linkTombstones().entrySet()) {
805 final LinkKey key = remoteRm.getKey();
806 final Timestamp remoteRemove = remoteRm.getValue();
807 // relying on removeLinkInternal to ignore stale info
808 notifyDelegateIfNotNull(removeLinkInternal(key, remoteRemove));
809 }
Madan Jampania97e8202014-10-10 17:01:33 -0700810
Yuta HIGUCHI2fe46a22014-10-15 22:51:02 -0700811 if (localOutdated) {
812 // send back advertisement to speed up convergence
813 try {
814 unicastMessage(sender, LINK_ANTI_ENTROPY_ADVERTISEMENT,
815 createAdvertisement());
816 } catch (IOException e) {
817 log.debug("Failed to send back active advertisement");
Madan Jampania97e8202014-10-10 17:01:33 -0700818 }
819 }
820 }
821
Yuta HIGUCHI80d56592014-11-25 15:11:13 -0800822 private final class InternalLinkEventListener
823 implements ClusterMessageHandler {
Madan Jampani2ff05592014-10-10 15:42:47 -0700824 @Override
825 public void handle(ClusterMessage message) {
826
Yuta HIGUCHIc01d2aa2014-10-19 01:19:34 -0700827 log.trace("Received link event from peer: {}", message.sender());
Madan Jampani2ff05592014-10-10 15:42:47 -0700828 InternalLinkEvent event = (InternalLinkEvent) SERIALIZER.decode(message.payload());
829
830 ProviderId providerId = event.providerId();
831 Timestamped<LinkDescription> linkDescription = event.linkDescription();
832
Madan Jampani2af244a2015-02-22 13:12:01 -0800833 try {
834 notifyDelegateIfNotNull(createOrUpdateLinkInternal(providerId, linkDescription));
835 } catch (Exception e) {
836 log.warn("Exception thrown handling link event", e);
837 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700838 }
839 }
840
Yuta HIGUCHI80d56592014-11-25 15:11:13 -0800841 private final class InternalLinkRemovedEventListener
842 implements ClusterMessageHandler {
Madan Jampani2ff05592014-10-10 15:42:47 -0700843 @Override
844 public void handle(ClusterMessage message) {
845
Yuta HIGUCHIc01d2aa2014-10-19 01:19:34 -0700846 log.trace("Received link removed event from peer: {}", message.sender());
Madan Jampani2ff05592014-10-10 15:42:47 -0700847 InternalLinkRemovedEvent event = (InternalLinkRemovedEvent) SERIALIZER.decode(message.payload());
848
849 LinkKey linkKey = event.linkKey();
850 Timestamp timestamp = event.timestamp();
851
Madan Jampani2af244a2015-02-22 13:12:01 -0800852 try {
853 notifyDelegateIfNotNull(removeLinkInternal(linkKey, timestamp));
854 } catch (Exception e) {
855 log.warn("Exception thrown handling link removed", e);
856 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700857 }
858 }
Madan Jampania97e8202014-10-10 17:01:33 -0700859
Yuta HIGUCHI80d56592014-11-25 15:11:13 -0800860 private final class InternalLinkAntiEntropyAdvertisementListener
861 implements ClusterMessageHandler {
Madan Jampania97e8202014-10-10 17:01:33 -0700862
863 @Override
864 public void handle(ClusterMessage message) {
Yuta HIGUCHIfaf9e1c2014-11-20 00:31:29 -0800865 log.trace("Received Link Anti-Entropy advertisement from peer: {}", message.sender());
Madan Jampania97e8202014-10-10 17:01:33 -0700866 LinkAntiEntropyAdvertisement advertisement = SERIALIZER.decode(message.payload());
Madan Jampani2af244a2015-02-22 13:12:01 -0800867 try {
868 handleAntiEntropyAdvertisement(advertisement);
869 } catch (Exception e) {
870 log.warn("Exception thrown while handling Link advertisements", e);
871 throw e;
872 }
Madan Jampania97e8202014-10-10 17:01:33 -0700873 }
874 }
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800875
876 private final class LinkInjectedEventListener
877 implements ClusterMessageHandler {
878 @Override
879 public void handle(ClusterMessage message) {
880
881 log.trace("Received injected link event from peer: {}", message.sender());
882 LinkInjectedEvent linkInjectedEvent = SERIALIZER.decode(message.payload());
883
884 ProviderId providerId = linkInjectedEvent.providerId();
885 LinkDescription linkDescription = linkInjectedEvent.linkDescription();
886
Madan Jampani2af244a2015-02-22 13:12:01 -0800887 try {
888 createOrUpdateLink(providerId, linkDescription);
889 } catch (Exception e) {
890 log.warn("Exception thrown while handling link injected event", e);
891 }
Marc De Leenheerb473b9d2015-02-06 15:21:03 -0800892 }
893 }
Madan Jampani2ff05592014-10-10 15:42:47 -0700894}