Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » DS service bind/unbind invoke sequence.(Is bind suppossed to be called before unbind ?)
DS service bind/unbind invoke sequence. [message #506917] Mon, 11 January 2010 10:48 Go to next message
gsarno  is currently offline gsarno Friend
Messages: 3
Registered: January 2010
Junior Member
Hello,
I experimented some code using DS services. I created 4 bundles:
1- containing the Interface of the service producers (Interface I)
2- containing implementation of Service A (implementing I)
3- Implementation of service B (Implementing same interface I)
4- Consumer
Consumer declares:
- a cardinality of 1..n
- two methods for "bind-ing", "unbind-ing".

Performing "update" on the bundle containing Service A, I noticed that unbind is actually invoked before. Should the Container invoke "bind" first so that the software has a chance to prepare for Service A replacement ?

Thanks.
Re: DS service bind/unbind invoke sequence. [message #507027 is a reply to message #506917] Mon, 11 January 2010 17:19 Go to previous messageGo to next message
BJ Hargrave is currently offline BJ HargraveFriend
Messages: 60
Registered: July 2009
Member
I assume Consumer has a dynamic reference to I. Therefore Consumer is bound to A and B since it has cardinality 1..n. So when bundle with A is updated, service A is unregistered and then unbound from Consumer. The when bundle is restarted, service A is reregistered and then bound to Consumer. At all times, B is bound to Consumer.

Seems like this is working properly to me.
Re: DS service bind/unbind invoke sequence. [message #507082 is a reply to message #507027] Tue, 12 January 2010 01:23 Go to previous message
gsarno  is currently offline gsarno Friend
Messages: 3
Registered: January 2010
Junior Member
Hello, thanks, yes assumptions correct.
Reading standard couple of times I get the same feeling but this is what I don't understand (may be too young on OSGi and Services) and I hope you(or anybody) can help me grasp.
If the Interface (Interface I) were describing a Dictionary Service and Service A was the English implementation and Service B The French implementation, if I had a bug or wanted to update the English version of the dictionary I would like to be able to bind the new Service A first and unbind the old. Little count that Service B is still there untouched (as it serves a different service).

In my example I want the Consume (Service C for instance) to decide and invoke either Service A or Service B based on Properties for example and if Service A (or B) goes away I would like to have a chance to detect the update and replace the Service before the old goes away.
Does this make sense ? Is it possible with the framework ?

[Updated on: Tue, 12 January 2010 01:23]

Report message to a moderator

Previous Topic:I am newer to equinox,how i can easily get the entire source code of Equinox 3.5.1
Next Topic:Web application
Goto Forum:
  


Current Time: Thu Apr 25 01:22:10 GMT 2024

Powered by FUDForum. Page generated in 0.03171 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top