BUG-6237: Topology freezes or slows down due to java.util.concurrent.TimeoutException
[bgpcep.git] / bgp / path-selection-mode / src / main / java / org / opendaylight / protocol / bgp / mode / impl / add / n / paths / AbstractNPathsRouteEntry.java
index 05cd878d12b36d73d7f387fc4c01f6337cd0bae5..f95abcd586b1f09bb4bff10f6ef7d3f51c640222 100644 (file)
@@ -36,8 +36,11 @@ abstract class AbstractNPathsRouteEntry extends AddPathAbstractRouteEntry {
             keyList.remove(newBest.getRouteKey());
         }
 
-        this.bestPathRemoved = new ArrayList<>(this.bestPath);
-        if (this.bestPathRemoved.removeAll(newBestPathList) && !this.bestPathRemoved.isEmpty() || !this.bestPath.equals(newBestPathList)) {
+        if(this.bestPath != null) {
+            this.bestPathRemoved = new ArrayList<>(this.bestPath);
+        }
+        if (!newBestPathList.equals(this.bestPath) ||
+            this.bestPathRemoved != null && this.bestPathRemoved.removeAll(newBestPathList) && !this.bestPathRemoved.isEmpty()) {
             this.bestPath = newBestPathList;
             LOG.trace("Actual Best {}, removed best {}", this.bestPath, this.bestPathRemoved);
             return true;