payert opened a new pull request #3304: URL: https://github.com/apache/ambari/pull/3304
## What changes were proposed in this pull request? When starting up or shutting down Ambari Metics in HA mode the following exceptions appear in the log: `javax.management.InstanceAlreadyExistsException: ClusterStatus: cluster=... ,instanceName=...` and `javax.management.InstanceNotFoundException: ClusterStatus: cluster=..,instanceName=...,resourceName=...` These are happening when trying to register/unregister an MBean. The double registration happens because the `HelixController` class was a subclass of `GenericHelixController` class, thus effectively it was a _Controller_ instance, despite the fact that it only needs to be a listener to track live Collector instances. By registering this `HelixController` class we basically used **two Controllers**, that caused the double registration and wasting of resources. The fix refactored `HelixController` to a `LiveInstanceTracker` class that is only a listener this way eliminating the situation where we had two Controllers. Furthermore the fix refactors the shutdown mechanism `MetricCollectorHAController` to provide a more graceful shutdown. Code cleanup was also performed. ## How was this patch tested? The manual testing is still in progress. Should not be merged until the testing is done! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
