I have component consuming MusicPlayer service, that service is declarative 
service and its component.xml
Looks like this 
   <implementationclass="playercoreimpl.MusicPlayerServiceImpl"/>
   <service>
      <provideinterface="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
   <implementationclass="testbundle.Activator"/>
   
<referencebind="setMusicPlayer"cardinality="1..1"interface="playercore.MusicPlayerService"name="MusicPlayerService"policy="dynamic"unbind="unsetMusicPlayer"/>

And bind and unbind methods look like this
    privateAtomicReference<MusicPlayerService> musicPlayerRef= 
newAtomicReference<MusicPlayerService>();
    publicvoidsetMusicPlayer(MusicPlayerService musicPlayer) {
        musicPlayerRef.set(musicPlayer);
        setMusicPlayerToPlayer(musicPlayer);
 
    }
 
    publicvoidunsetMusicPlayer(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

Reply via email to