Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Difference Between Bind & Activate??
Difference Between Bind & Activate?? [message #872999] Thu, 17 May 2012 05:31 Go to next message
Dinuka Perera is currently offline Dinuka Perera
Messages: 7
Registered: April 2012
Junior Member
Hi,
I started using OSGI in eclipse and under Declarative Services I found out that there are two methods thats 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?

Thanx in advance.

[Updated on: Thu, 17 May 2012 05:45]

Report message to a moderator

Re: Difference Between Bind & Activate?? [message #873067 is a reply to message #872999] Thu, 17 May 2012 08:53 Go to previous messageGo to next message
BJ Hargrave is currently offline BJ Hargrave
Messages: 55
Registered: July 2009
Member
The activate method is called when your component is activated. So this is a good time to perform any initialization activities. The bind method is called once for each service your component references. So if your component has a reference to LogService, your bind method will be called with the LogService bound to your component. The method can then store the LogService in a field.
Re: Difference Between Bind & Activate?? [message #873088 is a reply to message #873067] Thu, 17 May 2012 09:35 Go to previous message
Dinuka Perera is currently offline Dinuka Perera
Messages: 7
Registered: April 2012
Junior Member
Thanx.
I think I got it now.
Previous Topic:State of Equinox from 4.2
Next Topic:Import-Package necessary for org.xml.sax?
Goto Forum:
  


Current Time: Wed Jul 30 09:22:51 EDT 2014

Powered by FUDForum. Page generated in 0.09527 seconds