Merge "Use ClassToInstanceMap instead of a HashMap"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / lifecycle / ContextChainImpl.java
index 3702c9e2a10f61c2638da7c2a287e7dc4796caf5..275d0f25e0be97b7507f75aef6e63f7c4efd4a87 100644 (file)
@@ -75,21 +75,19 @@ public class ContextChainImpl implements ContextChain {
             LOG.info("Started clustering services for node {}", deviceInfo);
         } catch (final Exception ex) {
             LOG.warn("Not able to start clustering services for node {}", deviceInfo);
-            executorService.submit(() -> contextChainMastershipWatcher
+            executorService.execute(() -> contextChainMastershipWatcher
                     .onNotAbleToStartMastershipMandatory(deviceInfo, ex.toString()));
         }
     }
 
     @Override
-    public ListenableFuture<Void> closeServiceInstance() {
+    public ListenableFuture<?> closeServiceInstance() {
 
         contextChainMastershipWatcher.onSlaveRoleAcquired(deviceInfo);
 
-        final ListenableFuture<List<Void>> servicesToBeClosed = Futures
-                .allAsList(Lists.reverse(contexts)
-                        .stream()
-                        .map(OFPContext::closeServiceInstance)
-                        .collect(Collectors.toList()));
+        final ListenableFuture<?> servicesToBeClosed = Futures.allAsList(Lists.reverse(contexts).stream()
+            .map(OFPContext::closeServiceInstance)
+            .collect(Collectors.toList()));
 
         return Futures.transform(servicesToBeClosed, (input) -> {
             LOG.info("Closed clustering services for node {}", deviceInfo);
@@ -119,7 +117,7 @@ public class ContextChainImpl implements ContextChain {
         auxiliaryConnections.clear();
 
         // If we are still registered and we are not already closing, then close the registration
-        if (Objects.nonNull(registration)) {
+        if (registration != null) {
             try {
                 registration.close();
                 registration = null;
@@ -217,8 +215,8 @@ public class ContextChainImpl implements ContextChain {
 
     @Override
     public boolean addAuxiliaryConnection(@Nonnull ConnectionContext connectionContext) {
-        return (connectionContext.getFeatures().getAuxiliaryId() != 0)
-                && (!ConnectionContext.CONNECTION_STATE.RIP.equals(primaryConnection.getConnectionState()))
+        return connectionContext.getFeatures().getAuxiliaryId() != 0
+                && !ConnectionContext.CONNECTION_STATE.RIP.equals(primaryConnection.getConnectionState())
                 && auxiliaryConnections.add(connectionContext);
     }
 
@@ -256,4 +254,4 @@ public class ContextChainImpl implements ContextChain {
         masterStateOnDevice.set(false);
         rpcRegistration.set(false);
     }
-}
\ No newline at end of file
+}