Improve Mcast termination

Change-Id: I2855d28b374af821667e08bb3baec01f5cfd8100
(cherry picked from commit 173204690b035f1b9be36022c9dfd64f1f264123)
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java
index 50d0969d..3b659bd 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastHandler.java
@@ -351,7 +351,12 @@
      * Clean up when deactivating the application.
      */
     public void terminate() {
+        mcastEventCache.invalidateAll();
         executorService.shutdown();
+        mcastNextObjStore.destroy();
+        mcastRoleStore.destroy();
+        mcastUtils.terminate();
+        log.info("Terminated");
     }
 
     /**
@@ -372,7 +377,6 @@
         }
     }
 
-
     /**
      * Process the ROUTE_ADDED event.
      *
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastUtils.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastUtils.java
index fc89fde..2b13370 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastUtils.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/mcast/McastUtils.java
@@ -93,6 +93,13 @@
     }
 
     /**
+     * Clean up when deactivating the application.
+     */
+    public void terminate() {
+        mcastLeaderCache.clear();
+    }
+
+    /**
      * Get router mac using application config and the connect point.
      *
      * @param deviceId the device id