Type: Technical Task
Affects Version/s: None
Component/s: ~ [Archived] Collaboration
In several places like here a recurrent job is registered whenever any of the following scenarios is met:
- The component is activated (@Activate).
- The configuration changes (@Modified).
But said job is only unregistered when the component is deactivated (@Deactivate).
This causes one call to "register" every time the configuration changes without a previous one to "unregister". The observed behaviour after this happens is that the job runs periodically at the new configured interval (if changed) but it runs as many times as "register" has been called. As an example:
1. Job runs once every second by default.
2. We change the configuration to 1 minute.
3. Job does not run every second anymore.
4. We wait one minute.
5. Job runs twice rather than just once.
6. Go back to 2 and in step 5 the job will run 3 times and so on...
The fix provided here makes sure that before any registration logic occurs, any previous registration for the given listener is properly unregistered to avoid the leak described above.