Services are more dynamic than packages; they can come and go at will, package wiring cannot. Once a bundle is wired to a given package, it will not wire to another provider until the framework is refreshed. Performing an update is not sufficient. You must always refresh the framework to cause any rewiring.

-> richard

On 9/27/10 2:33, Sandra Krneta wrote:

I have component consuming MusicPlayer service, that service is declarative service and its component.xml

Looks like this

<implementation class="playercoreimpl.MusicPlayerServiceImpl"/>

<service>

<provide interface="playercore.MusicPlayerService"/>

</service>

Component that consumes it imports player core service

*Import-Package*:

org.osgi.framework;/version/="1.3.0",

playercore;/version/="[1.0.0,2.0.3)",

and has component.xml like this

<implementation class="testbundle.Activator"/>

<reference bind="setMusicPlayer" cardinality="1..1" interface="playercore.MusicPlayerService" name="MusicPlayerService" policy="dynamic" unbind="unsetMusicPlayer"/>

And bind and unbind methods look like this

* private* AtomicReference<MusicPlayerService> musicPlayerRef = *new* AtomicReference<MusicPlayerService>();

* public* *void* setMusicPlayer(MusicPlayerService musicPlayer) {

musicPlayerRef.set(musicPlayer);

setMusicPlayerToPlayer(musicPlayer);

}

*public* *void* unsetMusicPlayer(MusicPlayerService musicPlayer) {

musicPlayerRef.compareAndSet(musicPlayer, *null*);

}

The problem is, when I have two bundles that export playercore package (different versions)started in framework

and I stop one of them, just unbind method is called and consuming bundle stops, it doesn’t start using other version

of service. Update of consuming bundle doesn’t help.

One more thing is confusing, if bundle that exports playercore with lower version is started and consumer bundle is started,

But then I stop player corebundle, consuming bundle stops, then after installation and starting of playercore component

with higher version and update of consuming component, component is started, but vice versa it is not case.

I am using Equinox.

If anyone has solution for this, please let me know it is urgent



_______________________________________________
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