Update withdraw()/advertize() 07/97607/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 23 Sep 2021 10:46:57 +0000 (12:46 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 23 Sep 2021 10:46:57 +0000 (12:46 +0200)
We have a simple boolean dispatch here, mark the boolean and use a
a simple return expression.

Change-Id: I5f45d160ef30d9b307a2e28578609dbeca27bd95
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibOutListener.java

index d033e4f13160b65f16cf9033565240078107d967..79c97eefc28ea59a25b516a0aed2e7d6a280bb78 100644 (file)
@@ -64,6 +64,7 @@ final class AdjRibOutListener implements ClusteredDOMDataTreeChangeListener, Pre
     private final ChannelOutputLimiter session;
     private final Codecs codecs;
     private final RIBSupport<?, ?> support;
+    // FIXME: this field needs to be eliminated: either subclass this class or create a filtering ribsupport
     private final boolean mpSupport;
     private final ListenerRegistration<AdjRibOutListener> registerDataTreeChangeListener;
     private final LongAdder prefixesSentCounter = new LongAdder();
@@ -161,18 +162,16 @@ final class AdjRibOutListener implements ClusteredDOMDataTreeChangeListener, Pre
     }
 
     private Update withdraw(final MapEntryNode route) {
-        if (!mpSupport) {
-            return buildUpdate(Collections.emptyList(), Collections.singleton(route), routeAttributes(route));
-        }
-        return support.buildUpdate(Collections.emptyList(), Collections.singleton(route), routeAttributes(route));
+        return mpSupport
+            ? support.buildUpdate(Collections.emptyList(), Collections.singleton(route), routeAttributes(route))
+                : buildUpdate(Collections.emptyList(), Collections.singleton(route), routeAttributes(route));
     }
 
     private Update advertise(final MapEntryNode route) {
         prefixesSentCounter.increment();
-        if (!mpSupport) {
-            return buildUpdate(Collections.singleton(route), Collections.emptyList(), routeAttributes(route));
-        }
-        return support.buildUpdate(Collections.singleton(route), Collections.emptyList(), routeAttributes(route));
+        return mpSupport
+            ? support.buildUpdate(Collections.singleton(route), Collections.emptyList(), routeAttributes(route))
+                : buildUpdate(Collections.singleton(route), Collections.emptyList(), routeAttributes(route));
     }
 
     private static Update buildUpdate(