Jonathan Hart

IntentManager: Don't compile all failed intents on every event

Also don't compile all failed on any Host event. Intents that care about
hosts should have that host tracked and react to changes in that host only.

ONOS-2978

Change-Id: I1f6b2b2fa31987cffff0f9a7a9aa0191dc1edbcf
...@@ -256,11 +256,11 @@ public class IntentManager ...@@ -256,11 +256,11 @@ public class IntentManager
256 submit(intent); 256 submit(intent);
257 } 257 }
258 258
259 + if (compileAllFailed) {
259 // If required, compile all currently failed intents. 260 // If required, compile all currently failed intents.
260 for (Intent intent : getIntents()) { 261 for (Intent intent : getIntents()) {
261 IntentState state = getIntentState(intent.key()); 262 IntentState state = getIntentState(intent.key());
262 - if ((compileAllFailed && RECOMPILE.contains(state)) 263 + if (RECOMPILE.contains(state) || intentAllowsPartialFailure(intent)) {
263 - || intentAllowsPartialFailure(intent)) {
264 if (WITHDRAW.contains(state)) { 264 if (WITHDRAW.contains(state)) {
265 withdraw(intent); 265 withdraw(intent);
266 } else { 266 } else {
...@@ -268,6 +268,7 @@ public class IntentManager ...@@ -268,6 +268,7 @@ public class IntentManager
268 } 268 }
269 } 269 }
270 } 270 }
271 + }
271 272
272 //FIXME 273 //FIXME
273 // for (ApplicationId appId : batches.keySet()) { 274 // for (ApplicationId appId : batches.keySet()) {
......
...@@ -415,9 +415,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { ...@@ -415,9 +415,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService {
415 @Override 415 @Override
416 public void event(HostEvent event) { 416 public void event(HostEvent event) {
417 HostId id = event.subject().id(); 417 HostId id = event.subject().id();
418 - HostEvent.Type type = event.type(); 418 + executorService.execute(new DeviceAvailabilityHandler(id, false));
419 - boolean available = (type == HostEvent.Type.HOST_ADDED);
420 - executorService.execute(new DeviceAvailabilityHandler(id, available));
421 } 419 }
422 } 420 }
423 421
......