NETVIRT-1630 migrate to md-sal APIs
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / internal / InterfaceRemoveWorkerOnElanInterface.java
index 57a1dda30285bb5968c7bde91e9f99cf9fd80383..40035c0153cd4af0ef73859336e6d82eab48b446 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.netvirt.elan.internal;
 
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
 
@@ -18,7 +17,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class InterfaceRemoveWorkerOnElanInterface implements Callable<List<ListenableFuture<Void>>> {
+public class InterfaceRemoveWorkerOnElanInterface implements Callable<List<? extends ListenableFuture<?>>> {
 
     private static final Logger LOG = LoggerFactory.getLogger(InterfaceRemoveWorkerOnElanInterface.class);
 
@@ -45,16 +44,13 @@ public class InterfaceRemoveWorkerOnElanInterface implements Callable<List<Liste
 
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public List<ListenableFuture<Void>> call() throws Exception {
-        List<ListenableFuture<Void>> futures = new ArrayList<>();
+    public List<ListenableFuture<Void>> call() {
         try {
-            futures.addAll(dataChangeListener.removeEntriesForElanInterface(elanInfo, interfaceInfo, interfaceName,
-                    isLastElanInterface));
+            return dataChangeListener.removeEntriesForElanInterface(elanInfo, interfaceInfo, interfaceName,
+                    isLastElanInterface);
         } catch (RuntimeException e) {
-            LOG.error("Error while processing for interface {} and elan {}", interfaceName, elanInfo, e);
-            ElanUtils.addToListenableFutureIfTxException(e, futures);
+            return ElanUtils.returnFailedListenableFutureIfTransactionCommitFailedExceptionCauseOrElseThrow(e);
         }
-        return futures;
     }
 
 }