[CORD-2531] Missing flows and multicast groups

The rationale for this change is: unhandled exceptions
prevent Runnable to be scheduled in future.
We need to protect the body of runnable.

Related to [CORD-2532] and [CORD-2533].

In the pipeliner we use checkers and groups listener
to get notification about groups. The error scenario:
unhandled exception in the context of a group checker
will kill the checker. We create a multicast group, which
requires firstly a l2interfacegroup. The latter has been
already created in the past. No notification from groups
and no checker -> failure. Multicast group is not created
and forwarding objective in pending (forever).

Potentially, it can fix other errors scenario.

Change-Id: I6ea0548c112002b9ce415103891dc01431bc1dc8
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java
index f9cf3d0..df03656 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java
@@ -534,22 +534,30 @@
 
         @Override
         public void run() {
-            if (groupHandler.pendingGroups().size() != 0) {
-                log.debug("pending groups being checked: {}", groupHandler.pendingGroups().asMap().keySet());
-            }
-            if (groupHandler.pendingAddNextObjectives().size() != 0) {
-                log.debug("pending add-next-obj being checked: {}",
-                          groupHandler.pendingAddNextObjectives().asMap().keySet());
-            }
-            Set<GroupKey> keys = groupHandler.pendingGroups().asMap().keySet().stream()
-                    .filter(key -> groupHandler.groupService.getGroup(groupHandler.deviceId, key) != null)
-                    .collect(Collectors.toSet());
-            Set<GroupKey> otherkeys = groupHandler.pendingAddNextObjectives().asMap().keySet().stream()
-                    .filter(otherkey -> groupHandler.groupService.getGroup(groupHandler.deviceId, otherkey) != null)
-                    .collect(Collectors.toSet());
-            keys.addAll(otherkeys);
+            // GroupChecker execution needs to be protected
+            // from unhandled exceptions
+            try {
+                if (groupHandler.pendingGroups().size() != 0) {
+                    log.debug("pending groups being checked: {}", groupHandler.pendingGroups().asMap().keySet());
+                }
+                if (groupHandler.pendingAddNextObjectives().size() != 0) {
+                    log.debug("pending add-next-obj being checked: {}",
+                              groupHandler.pendingAddNextObjectives().asMap().keySet());
+                }
+                Set<GroupKey> keys = groupHandler.pendingGroups().asMap().keySet().stream()
+                        .filter(key -> groupHandler.groupService.getGroup(groupHandler.deviceId, key) != null)
+                        .collect(Collectors.toSet());
+                Set<GroupKey> otherkeys = groupHandler.pendingAddNextObjectives().asMap().keySet().stream()
+                        .filter(otherkey -> groupHandler.groupService.getGroup(groupHandler.deviceId, otherkey) != null)
+                        .collect(Collectors.toSet());
+                keys.addAll(otherkeys);
 
-            keys.forEach(key -> groupHandler.processPendingAddGroupsOrNextObjs(key, false));
+                keys.forEach(key -> groupHandler.processPendingAddGroupsOrNextObjs(key, false));
+            } catch (Exception exception) {
+                // Just log. It is safe for now.
+                log.warn("Uncaught exception is detected: {}", exception.getMessage());
+                log.debug("Uncaught exception is detected (full stack trace): ", exception);
+            }
         }
     }
 }