[VOL-3088] Moving the leadership check in the executor

Change-Id: Id194fd4b1bb443d9a094afe607361ea1dc493488
diff --git a/app/src/main/java/org/opencord/cordmcast/impl/CordMcast.java b/app/src/main/java/org/opencord/cordmcast/impl/CordMcast.java
index 7f1a4d1..c8860d0 100644
--- a/app/src/main/java/org/opencord/cordmcast/impl/CordMcast.java
+++ b/app/src/main/java/org/opencord/cordmcast/impl/CordMcast.java
@@ -789,7 +789,8 @@
         public void event(DeviceEvent event) {
             eventExecutor.execute(() -> {
                 DeviceId devId = event.subject().id();
-                if (!deviceService.isAvailable(devId)) {
+                if (!deviceService.isAvailable(devId) &&
+                        isLocalLeader(event.subject().id())) {
                     if (deviceService.getPorts(devId).isEmpty()) {
                         log.info("Handling controlled device disconnection .. "
                                          + "flushing all state for dev:{}", devId);
@@ -805,9 +806,6 @@
                                          + "assuming temporary disconnection, "
                                          + "retaining state for device {}", devId);
                     }
-                } else {
-                    log.debug("Device is connected {}, " +
-                                      "currently not handling", devId);
                 }
             });
 
@@ -815,8 +813,7 @@
 
         @Override
         public boolean isRelevant(DeviceEvent event) {
-            return isLocalLeader(event.subject().id())
-                    && event.type().equals(DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED);
+            return event.type().equals(DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED);
         }
     }