You cannot do this. When you unregister the service, all service objects are released. You don't unregister service instances; you unregister the entire service registration. --
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: Chetan Mehrotra <[email protected]> To: OSGi Developer Mail List <[email protected]> Date: 2014/01/10 05:13 Subject: [osgi-dev] Unregistering specific instances of ServiceFactory Sent by: [email protected] In our system we have a ServiceFactory SF1 which creates instances of service S1. The service instance is bound to bundles which have asked for service from service factory. If I unregister the SF1 then it leads to unregistrations of all the service instances created from SF1 Now in some case we need to unregister the service instance of S1 for some specific bundles only. For example - Bundle B1 has S1A - Bundle B2 has S1B - Bundle B3 has S1C Where S1X is an instance of S1 produced from SF1 Now a SF interface [1] is as below Object getService(Bundle bundle, ServiceRegistration registration) Provides the calling bundle reference and also the ServiceRegistration object. Would it be fine if Bundle of SF1 invokes the registration.unregister() method. This would allow us to unregister services for specific bundle like S1A, S1B but leave service registered for B3 i.e. S1C Chetan Mehrotra [1] http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/ServiceFactory.html _______________________________________________ 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
