B has an optional dynamic reference to A.
A has a mandatory dynamic reference to B.

So B must be activated first without an A service.
A can then be activated with the B service.
B can then have the A service bound to it.


-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[email protected]

office: +1 386 848 1781
mobile: +1 386 848 3788




From:
rajalaxmi chandran <[email protected]>
To:
[email protected]
Date:
2009/05/14 12:32
Subject:
[osgi-dev] circular service dependencies in osgi
Sent by:
[email protected]






Hi,
please help....
i am stuck with circular dependecies in osgi. i am using declarative 
services. This is my situation
*Component A registers ServiceA
*Component B registers ServiceB
*Component A needs to use ServiceB
*Component B needs to use ServiceA.
 
componetA.xml file has:
<?xml version="1.0" encoding="UTF-8"?> 
<component name="componentA" immediate="true"> 
<implementation class="serviceAimpl.serviceAimpl"/> 
      <service> 
          <provide interface="serviceA.serviceA"/> 
      </service> 
<reference name="SERVICEBUSE" interface="serviceB.serviceB" bind="set" 
unbind=unset" cardinality="1..1" policy="dynamic"/> 
</component> 
 
componentB.xml file has: 
<?xml version="1.0" encoding="UTF-8"?> 
<component name="componentB"> 
<implementation class="serviceBimpl.serviceBimpl"/> 
        <service> 
               <provide interface="serviceB.serviceB"/> 
       </service> 
<reference name="SERVICEAUSE" interface="serviceA.serviceA" bind="set" 
unbind="unset" cardinality="0..1" policy="dynamic"/> 
</component> 
 
component A gets activated because of the immediate attribute being true, 
but i cannot use the serviceB nor is componentB able to use serviceA.... 
how do i rectify this error???????????? 
 
how do we implement service contracts in OSGI???? 
 
please help 
thank you 
Raji


Explore and discover exciting holidays and getaways with Yahoo! India 
Travel Click here!_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to