Thank you, Yes I guess I had not read very well.. This actually works ok. I clearly remember though in my previous prototype equinox to call bind first in a 0..n configuration. But I guess this might be implementation specific. Wondering why this does not apply to x..n . Just out of curiosity..
Also those are my observations at least on the container I am using (felix/jboss): Service A and B share the same service interface. 1) Prerequisites: A active and running. Installed B and activated. Action: Stopping A Result: It works ok ...setService for service B is called first and then unsetService for service A is called. 2) Prerequisites: A active and running. B installed but not active Action: Update A Result: unsetService is called first in this case. I guess this is what Neil was referring above. I guess in this case won't be able to hot replace A ? Again sorry this might be an implementation specific question but doesn't this break the specification (112.5.10) ? 3) Prerequisites: A,B active. Action: update A. Result: had an issue with this.. At this point I am a bit confused on how to use the deployment model of OSGi. I have the following question I hope anybody can help answering: 1) How can I implement a model where I have multiple services implementing same interface but independent implementation and been able to hot replace them ? >From what seen so far considering the dictionary example above I wouldn't be >able to transparently replace individual Dictionaries with a new version but >only add new ones? Or remove them. Example: Single web entry for a dictionary service. Broker (service listener) logic decides which language to invoke and perform the request on the specific language. Languages are different services (different bundles) all inheriting from a common base class (service interface) which probably will be deployed as a separate bundle. Each individual language is individually hot replaceable. Thanks for your prompt help. Giuseppe. -----Original Message----- From: osgi-dev-boun...@mail.osgi.org [mailto:osgi-dev-boun...@mail.osgi.org] On Behalf Of Felix Meschberger Sent: 26 October 2011 17:03 To: OSGi Developer Mail List Subject: Re: [osgi-dev] Bind and unbind sequence is DS service update. Hi, Are you refering to Section 112.5.10, Bound Service Replacement ? This just applies to unary (cardinality of 0..1 or 1..1) services. Your case involves multiple cardinality (1..n) and so this replacement does not apply. Here the services are bound and unbound as they come and go. Regards Felix On Wed, Oct 26, 2011 at 3:58 PM, Giuseppe Sarno <giuseppe.sa...@genband.com> wrote: > Hello, > > I was playing with JBOSS 7.0 and trying to implement a prototype of a > DS service which automatically (dynamically) binds other DS services. > > I had done similar prototype some time ago but using the equinox container. > With the original prototype I believe the container did call the "bind" > method before the "unbind" upon update. I think this is what I read > through the line of the OSGI spec and the OSGI in practise book from > Neil B.. This way I had the chance to automatically and transparently > replace a service without affecting the run time processing. I did not > have similar behaviour using the JBOSS container (code is slightly > different so the change might have triggered the different behaviour). > The post is at http://community.jboss.org/thread/174057. My goal is to > replace a service while the system is running and there are calls to > the service. Can anybody please help to understand correct behaviour > and anything I should do to achieve the goal ? > > > > Thanks for your help. > > > > Attached below is the xml descriptor of the DS service. Should the > setDictionary method on DictionaryService implementation be called > before unsetDictionary upon update? > > > > <?xml version="1.0" encoding="UTF-8"?> > > <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" > name="osgi.example.service.broker"> > > <implementation > class="osgi.example.service.broker.DictionaryServiceImpl"/> > > <service> > > <provide > interface="osgi.example.service.broker.interf.DictionaryService"/> > > </service> > > <reference bind="setDictionary" cardinality="1..n" > interface="osgi.example.service.Dictionary" name="Dictionary" > policy="dynamic" unbind="unsetDictionary"/> > > </scr:component> > > > > > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev > _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev