Migrate to use LoggingFutures 45/82545/7
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Jun 2019 11:09:16 +0000 (13:09 +0200)
committerFaseela K <faseela.k@ericsson.com>
Mon, 1 Jul 2019 07:00:01 +0000 (07:00 +0000)
JdkFutures are not taking advantage of various known implementations,
which LoggingFutures does. This migrates code to use new equivalent
method.

Change-Id: Ifd8ae59f82cdb2eb8ea70783bc81288139e5c3d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
alivenessmonitor/alivenessmonitor-impl-protocols/src/main/java/org/opendaylight/genius/alivenessmonitor/protocols/internal/AlivenessProtocolHandlerLLDP.java
itm/itm-impl/src/main/java/org/opendaylight/genius/itm/impl/ItmProvider.java
mdsalutil/mdsalutil-testutils/src/main/java/org/opendaylight/genius/datastoreutils/testutils/TestableDataBroker.java

index 07c3a81ec7ccff9d4d6f3062459357b47f18aef7..f354153c1ccec9df6bc47b4a47b9eb139a7713f6 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.genius.alivenessmonitor.protocols.internal;
 
-import static org.opendaylight.infrautils.utils.concurrent.JdkFutures.addErrorLogging;
+import static org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
@@ -183,7 +183,7 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl
         return split[2];
     }
 
-    private List<ActionInfo> getInterfaceActions(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
+    private static List<ActionInfo> getInterfaceActions(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
             .interfaces.rev140508.interfaces.state.Interface interfaceState, long portNum)
                     throws InterruptedException, ExecutionException {
         Class<? extends InterfaceType> intfType;
@@ -252,7 +252,7 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl
         return ethernetPacket;
     }
 
-    private String colonize(String orig) {
+    private static String colonize(String orig) {
         return orig.replaceAll("(?<=..)(..)", ":$1");
     }
 
@@ -262,11 +262,7 @@ public class AlivenessProtocolHandlerLLDP extends AbstractAlivenessProtocolHandl
         return interfaceName + EtherTypes.LLDP;
     }
 
-    private String getInterfaceName(EndpointType endpoint) {
-        String interfaceName = null;
-        if (endpoint instanceof Interface) {
-            interfaceName = ((Interface) endpoint).getInterfaceName();
-        }
-        return interfaceName;
+    private static String getInterfaceName(EndpointType endpoint) {
+        return endpoint instanceof Interface ? ((Interface) endpoint).getInterfaceName() : null;
     }
 }
index cffd395f961dc9ac5e5d8b724b0caa023815c593..93188effecdde27bd07b31edc8601cf6e648a1b4 100644 (file)
@@ -45,7 +45,7 @@ import org.opendaylight.genius.itm.rpc.ItmManagerRpcService;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.infrautils.diagstatus.ServiceState;
 import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
+import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
 import org.opendaylight.mdsal.eos.binding.api.Entity;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipCandidateRegistration;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange;
@@ -238,7 +238,7 @@ public class ItmProvider implements AutoCloseable, IITMProvider /*,ItmStateServi
         AddExternalTunnelEndpointInput addExternalTunnelEndpointInput =
                 new AddExternalTunnelEndpointInputBuilder().setTunnelType(tunnelType)
                         .setDestinationIp(dcgwIP).build();
-        JdkFutures.addErrorLogging(itmRpcService.addExternalTunnelEndpoint(addExternalTunnelEndpointInput),
+        LoggingFutures.addErrorLogging(itmRpcService.addExternalTunnelEndpoint(addExternalTunnelEndpointInput),
                 LOG, "addExternalTunnelEndpoint");
     }
 
@@ -247,7 +247,7 @@ public class ItmProvider implements AutoCloseable, IITMProvider /*,ItmStateServi
         RemoveExternalTunnelEndpointInput removeExternalTunnelEndpointInput =
                 new RemoveExternalTunnelEndpointInputBuilder().setTunnelType(tunnelType)
                         .setDestinationIp(dcgwIP).build();
-        JdkFutures.addErrorLogging(itmRpcService.removeExternalTunnelEndpoint(removeExternalTunnelEndpointInput),
+        LoggingFutures.addErrorLogging(itmRpcService.removeExternalTunnelEndpoint(removeExternalTunnelEndpointInput),
                 LOG, "removeExternalTunnelEndpoint");
     }
 
index f00b0aab23e2ad09f2d054b84e72accd51e29031..527219c14c41c69685b00e2dd99d833365d4c860 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.infrautils.utils.concurrent.Executors;
-import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
+import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.slf4j.Logger;
@@ -78,7 +78,7 @@ public abstract class TestableDataBroker implements DataBroker {
      * were exceptions in the listener.
      */
     public void asyncFireDataTreeChangeListener() {
-        JdkFutures.addErrorLogging(executor.submit(() -> fireDataTreeChangeListener()),
+        LoggingFutures.addErrorLogging(executor.submit(() -> fireDataTreeChangeListener()),
                 LOG, "fireDataTreeChangeListener() eventually failed");
     }