BUG-614: No need to build a future list 62/7562/2
authorRobert Varga <rovarga@cisco.com>
Sun, 1 Jun 2014 07:52:44 +0000 (09:52 +0200)
committerRobert Varga <rovarga@cisco.com>
Sun, 1 Jun 2014 17:38:35 +0000 (19:38 +0200)
It is obvious that the constructed list of futures is never going to be
used, so let's not construct it at all.

Change-Id: I506e33da52c53b5e63088a5c8ae0bb206eb6a720
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.java

index 5c7d924..49d5102 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.sal.binding.impl;
 import java.util.Collections;
 import java.util.Set;
 import java.util.concurrent.ExecutorService;
 import java.util.Collections;
 import java.util.Set;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
 
 import org.eclipse.xtext.xbase.lib.Conversions;
 import org.eclipse.xtext.xbase.lib.Functions.Function1;
 
 import org.eclipse.xtext.xbase.lib.Conversions;
 import org.eclipse.xtext.xbase.lib.Functions.Function1;
@@ -28,8 +27,6 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.HashMultimap;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
@@ -86,15 +83,10 @@ public class NotificationBrokerImpl implements NotificationProviderService, Auto
         };
         final Set<NotifyTask> tasks = IterableExtensions.<NotifyTask>toSet(
                 IterableExtensions.<NotificationListener<?>, NotifyTask>map(listenerToNotify, _function));
         };
         final Set<NotifyTask> tasks = IterableExtensions.<NotifyTask>toSet(
                 IterableExtensions.<NotificationListener<?>, NotifyTask>map(listenerToNotify, _function));
-        this.submitAll(executor, tasks);
-    }
 
 
-    private ImmutableSet<Future<Object>> submitAll(final ExecutorService service, final Set<NotifyTask> tasks) {
-        final Builder<Future<Object>> ret = ImmutableSet.<Future<Object>>builder();
         for (final NotifyTask task : tasks) {
         for (final NotifyTask task : tasks) {
-            ret.add(service.submit(task));
+            service.submit(task);
         }
         }
-        return ret.build();
     }
 
     @Override
     }
 
     @Override