OPNFLWPLUG-1105 : Fix for get-active bundle DOMRpcImplementationNotAvailableException 28/92128/4
authorDheenadayalan.b <dhinua@gmail.com>
Thu, 13 Aug 2020 08:08:50 +0000 (13:38 +0530)
committerDheenadayalan.b <dhinua@gmail.com>
Wed, 16 Sep 2020 03:45:48 +0000 (09:15 +0530)
description: GetActive Bundles failed  with "No implementation of RPC AbsoluteSchemaPath" exception even after the path registered successfully.
              Issue Observered when multiple Switches connected to controller, and some of them were restarted.
  During restart previous bundle rpc registrations are overwritten.
  Fix done as registrations are stored and retrieved using map.

Signed-off-by: Dheenadayalan.b <dhinua@gmail.com>
Change-Id: I4de90445db2f5b29e4fefb2d5bd296cdcd73af8a
Signed-off-by: Dheenadayalan.b <dhinua@gmail.com>
applications/arbitratorreconciliation/impl/src/main/java/org/opendaylight/openflowplugin/applications/arbitratorreconciliation/impl/ArbitratorReconciliationManagerImpl.java

index e677cf0a406475e57df1b5aa496252c5824b5793..e3d819f58e6d6d76104072d0a7e218d9fbb1685e 100644 (file)
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicLong;
@@ -121,7 +122,8 @@ public class ArbitratorReconciliationManagerImpl implements ArbitratorReconcileS
     private final ListeningExecutorService executor = MoreExecutors.listeningDecorator(
             Executors.newFixedThreadPool(THREAD_POOL_SIZE));
     private final Map<Uint64, BundleDetails> bundleIdMap = new ConcurrentHashMap<>();
-    private  ObjectRegistration<? extends RpcService> rpcRegistration;
+    private final ConcurrentMap<String,
+            ObjectRegistration<? extends RpcService>> rpcRegistrations = new ConcurrentHashMap<>();
 
     @Inject
     public ArbitratorReconciliationManagerImpl(
@@ -374,16 +376,20 @@ public class ArbitratorReconciliationManagerImpl implements ArbitratorReconcileS
         KeyedInstanceIdentifier<Node, NodeKey> path = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, new NodeKey(node.getNodeId()));
         LOG.debug("The path is registered : {}", path);
-        rpcRegistration = rpcProviderService.registerRpcImplementation(ArbitratorReconcileService.class,
-                this, ImmutableSet.of(path));
+        ObjectRegistration<? extends RpcService> rpcRegistration =
+                rpcProviderService.registerRpcImplementation(ArbitratorReconcileService.class,
+                        this, ImmutableSet.of(path));
+        rpcRegistrations.put(node.getNodeId().getValue(), rpcRegistration);
     }
 
     private void deregisterRpc(DeviceInfo node) {
         KeyedInstanceIdentifier<Node, NodeKey> path = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, new NodeKey(node.getNodeId()));
         LOG.debug("The path is unregistered : {}", path);
+        ObjectRegistration<? extends RpcService> rpcRegistration = rpcRegistrations.get(node.getNodeId().getValue());
         if (rpcRegistration != null) {
             rpcRegistration.close();
+            rpcRegistrations.remove(node.getNodeId().getValue());
         }
     }