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,15 +256,16 @@ public class IntentManager ...@@ -256,15 +256,16 @@ public class IntentManager
256 submit(intent); 256 submit(intent);
257 } 257 }
258 258
259 - // If required, compile all currently failed intents. 259 + if (compileAllFailed) {
260 - for (Intent intent : getIntents()) { 260 + // If required, compile all currently failed intents.
261 - IntentState state = getIntentState(intent.key()); 261 + for (Intent intent : getIntents()) {
262 - if ((compileAllFailed && RECOMPILE.contains(state)) 262 + IntentState state = getIntentState(intent.key());
263 - || intentAllowsPartialFailure(intent)) { 263 + if (RECOMPILE.contains(state) || intentAllowsPartialFailure(intent)) {
264 - if (WITHDRAW.contains(state)) { 264 + if (WITHDRAW.contains(state)) {
265 - withdraw(intent); 265 + withdraw(intent);
266 - } else { 266 + } else {
267 - submit(intent); 267 + submit(intent);
268 + }
268 } 269 }
269 } 270 }
270 } 271 }
......
...@@ -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
......