Unregister host listener when deactivating mobility app
Change-Id: I7f81dffb3e35da9e56893085a9e1e2d793036e85
Showing
1 changed file
with
3 additions
and
1 deletions
| ... | @@ -68,12 +68,13 @@ public class HostMobility { | ... | @@ -68,12 +68,13 @@ public class HostMobility { |
| 68 | 68 | ||
| 69 | private ApplicationId appId; | 69 | private ApplicationId appId; |
| 70 | private ExecutorService eventHandler; | 70 | private ExecutorService eventHandler; |
| 71 | + private final HostListener hostListener = new InternalHostListener(); | ||
| 71 | 72 | ||
| 72 | @Activate | 73 | @Activate |
| 73 | public void activate() { | 74 | public void activate() { |
| 74 | appId = coreService.registerApplication("org.onosproject.mobility"); | 75 | appId = coreService.registerApplication("org.onosproject.mobility"); |
| 75 | eventHandler = newSingleThreadScheduledExecutor(groupedThreads("onos/app-mobility", "event-handler", log)); | 76 | eventHandler = newSingleThreadScheduledExecutor(groupedThreads("onos/app-mobility", "event-handler", log)); |
| 76 | - hostService.addListener(new InternalHostListener()); | 77 | + hostService.addListener(hostListener); |
| 77 | log.info("Started with Application ID {}", appId.id()); | 78 | log.info("Started with Application ID {}", appId.id()); |
| 78 | } | 79 | } |
| 79 | 80 | ||
| ... | @@ -81,6 +82,7 @@ public class HostMobility { | ... | @@ -81,6 +82,7 @@ public class HostMobility { |
| 81 | public void deactivate() { | 82 | public void deactivate() { |
| 82 | // TODO we never actually add any flow rules | 83 | // TODO we never actually add any flow rules |
| 83 | flowRuleService.removeFlowRulesById(appId); | 84 | flowRuleService.removeFlowRulesById(appId); |
| 85 | + hostService.removeListener(hostListener); | ||
| 84 | eventHandler.shutdown(); | 86 | eventHandler.shutdown(); |
| 85 | log.info("Stopped"); | 87 | log.info("Stopped"); |
| 86 | } | 88 | } | ... | ... |
-
Please register or login to post a comment