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
activate
method is called when your component is activated. So this is a good time to perform any initialization activities. Abind
method is called once for each service your component references. So if your component has a reference toLogService
, yourbind
method forLogService
will be called with eachLogService
object bound to your component. The method can then store theLogService
in a field.