Unregisters a service. Remove a {@code ServiceRegistration} object fromthe Framework service registry. All {@code ServiceReference} objectsassociated with this {@code ServiceRegistration} object can no longer beused to interact with the service once unregistration is complete.
The following steps are required to unregister a service:
- The service is removed from the Framework service registry so that it can no longer be obtained.
- A service event of type {@link ServiceEvent#UNREGISTERING} is firedso that bundles using this service can release their use of the service. Once delivery of the service event is complete, the {@code ServiceReference} objects for the service may no longer be used toget a service object for the service.
- For each bundle whose use count for this service is greater than zero:
- The bundle's use count for this service is set to zero.
- If the service was registered with a {@link ServiceFactory} object,the {@code ServiceFactory.ungetService} method is called to release theservice object for the bundle.
@throws IllegalStateException If this {@code ServiceRegistration} objecthas already been unregistered.
@see BundleContext#ungetService(ServiceReference)
@see ServiceFactory#ungetService(Bundle,ServiceRegistration,Object)