In a project I am working on there are multiple servlets, services with an activate function with @activate annotation where the function has no body, said activate function is taking a configuration as parameter. The configuration has a single field. I am attaching code snippet for one such case below for reference.
What is the reason behind these empty activate functions, as they are not passing any value from configuration. furthermore what impact might removing such activate function can cause.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @shubham_naik to me it looks like a dead code. In my opinion having empty activate method does not bring any benefit. I think that removing such an empty activate method will not affect component/service functionality. In other words it should be safe to remove those methods. There is a nice documentation page that explains OSGi component lifecycle including activate, modify, deactivate annotation/methods usage - maybe this could be useful for you.
Hi @shubham_naik to me it looks like a dead code. In my opinion having empty activate method does not bring any benefit. I think that removing such an empty activate method will not affect component/service functionality. In other words it should be safe to remove those methods. There is a nice documentation page that explains OSGi component lifecycle including activate, modify, deactivate annotation/methods usage - maybe this could be useful for you.
Yes I agree with @lukasz-m here, if you want to understand OCD with @activate ,modify and deactivate annotations , please refer this : https://aem4beginner.blogspot.com/ocd-issue-with-activate-annotation.
Thanks a lot for the confirmation and resources @DEBAL_DAS