ONOS-2979 ObjectiveTracker improvements

- Removing unused intent map
- Passing copy of intents to recompile to prevent ConcurrentModificationException
- Dropping Host Updated events (only act on ADDED, MOVED, and REMOVED)

Change-Id: I86520c45f51e74c21cc47aab94a746c0b4135f93
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
index 4996db9..1f3f852 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -16,8 +16,8 @@
 package org.onosproject.net.intent.impl;
 
 import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 import com.google.common.collect.SetMultimap;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -61,7 +61,6 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
@@ -91,8 +90,6 @@
 
     private final Logger log = getLogger(getClass());
 
-    private final ConcurrentMap<Key, Intent> intents = Maps.newConcurrentMap();
-
     private final SetMultimap<LinkKey, Key> intentsByLink =
             //TODO this could be slow as a point of synchronization
             synchronizedSetMultimap(HashMultimap.<LinkKey, Key>create());
@@ -378,7 +375,7 @@
             }
 
             // TODO should we recompile on available==true?
-            delegate.triggerCompile(intentsByDevice.get(id), available);
+            delegate.triggerCompile(ImmutableSet.copyOf(intentsByDevice.get(id)), available);
         }
     }
 
@@ -415,7 +412,17 @@
         @Override
         public void event(HostEvent event) {
             HostId id = event.subject().id();
-            executorService.execute(new DeviceAvailabilityHandler(id, false));
+            switch (event.type()) {
+                case HOST_ADDED:
+                case HOST_MOVED:
+                case HOST_REMOVED:
+                    executorService.execute(new DeviceAvailabilityHandler(id, false));
+                    break;
+                case HOST_UPDATED:
+                default:
+                    // DO NOTHING
+                    break;
+            }
         }
     }