Committed by
Gerrit Code Review
Objective tracker doesn't need to react to port events
Change-Id: I73ce4d09a0d8f9ba24d335798187de83f515d5a1
Showing
1 changed file
with
20 additions
and
12 deletions
| ... | @@ -390,19 +390,27 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -390,19 +390,27 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
| 390 | @Override | 390 | @Override |
| 391 | public void event(DeviceEvent event) { | 391 | public void event(DeviceEvent event) { |
| 392 | DeviceEvent.Type type = event.type(); | 392 | DeviceEvent.Type type = event.type(); |
| 393 | - if (type == DeviceEvent.Type.PORT_ADDED || | 393 | + switch (type) { |
| 394 | - type == DeviceEvent.Type.PORT_UPDATED || | 394 | + case DEVICE_ADDED: |
| 395 | - type == DeviceEvent.Type.PORT_REMOVED) { | 395 | + case DEVICE_AVAILABILITY_CHANGED: |
| 396 | - // skip port events for now | 396 | + case DEVICE_REMOVED: |
| 397 | - return; | 397 | + case DEVICE_SUSPENDED: |
| 398 | + case DEVICE_UPDATED: | ||
| 399 | + DeviceId id = event.subject().id(); | ||
| 400 | + // TODO we need to check whether AVAILABILITY_CHANGED means up or down | ||
| 401 | + boolean available = (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || | ||
| 402 | + type == DeviceEvent.Type.DEVICE_ADDED || | ||
| 403 | + type == DeviceEvent.Type.DEVICE_UPDATED); | ||
| 404 | + executorService.execute(new DeviceAvailabilityHandler(id, available)); | ||
| 405 | + break; | ||
| 406 | + case PORT_ADDED: | ||
| 407 | + case PORT_REMOVED: | ||
| 408 | + case PORT_UPDATED: | ||
| 409 | + case PORT_STATS_UPDATED: | ||
| 410 | + default: | ||
| 411 | + // Don't handle port events for now | ||
| 412 | + break; | ||
| 398 | } | 413 | } |
| 399 | - DeviceId id = event.subject().id(); | ||
| 400 | - // TODO we need to check whether AVAILABILITY_CHANGED means up or down | ||
| 401 | - boolean available = (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || | ||
| 402 | - type == DeviceEvent.Type.DEVICE_ADDED || | ||
| 403 | - type == DeviceEvent.Type.DEVICE_UPDATED); | ||
| 404 | - executorService.execute(new DeviceAvailabilityHandler(id, available)); | ||
| 405 | - | ||
| 406 | } | 414 | } |
| 407 | } | 415 | } |
| 408 | 416 | ... | ... |
-
Please register or login to post a comment