I started using OSGI in eclipse.Under Declarative Services I found out that there are two methods that's been executed once a service is activated. I.e Activate and Bind.. What is the difference between these two?
If I want to execute certain actions to be performed when my service is started, do I put it in the Bind method or the Activate method?
The
activatemethod is called when your component is activated. So this is a good time to perform any initialization activities. Abindmethod is called once for each service your component references. So if your component has a reference toLogService, yourbindmethod forLogServicewill be called with eachLogServiceobject bound to your component. The method can then store theLogServicein a field.