]
Thomas Diesler updated JBOSGI-144:
----------------------------------
Summary: Framework does not handle ServiceFactory provided services properly (was:
Framework does not cache ServiceFactory provided service instances)
Framework does not handle ServiceFactory provided services properly
-------------------------------------------------------------------
Key: JBOSGI-144
URL:
https://jira.jboss.org/jira/browse/JBOSGI-144
Project: JBoss OSGi
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Core
Reporter: Thomas Diesler
Assignee: Thomas Diesler
Fix For: Framework 1.0.0 Alpha1
http://www.osgi.org/javadoc/r4v41/org/osgi/framework/BundleContext.html#g...
A bundle's use of a service is tracked by the bundle's use count of that
service. Each time a service's service object is returned by
getService(ServiceReference) the context bundle's use count for that service is
incremented by one. Each time the service is released by ungetService(ServiceReference)
the context bundle's use count for that service is decremented by one.
When a bundle's use count for a service drops to zero, the bundle should no longer
use that service.
This method will always return null when the service associated with this reference has
been unregistered.
The following steps are required to get the service object:
1. If the service has been unregistered, null is returned.
2. The context bundle's use count for this service is incremented by one.
3. If the context bundle's use count for the service is currently one and the service
was registered with an object implementing the ServiceFactory interface, the
ServiceFactory.getService(Bundle, ServiceRegistration) method is called to create a
service object for the context bundle. This service object is cached by the Framework.
While the context bundle's use count for the service is greater than zero, subsequent
calls to get the services's service object for the context bundle will return the
cached service object. If the service object returned by the ServiceFactory object is not
an instanceof all the classes named when the service was registered or the ServiceFactory
object throws an exception, null is returned and a Framework event of type
FrameworkEvent.ERROR is fired.
4. The service object for the service is returned.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: