[
https://jira.jboss.org/jira/browse/JBOSGI-144?page=com.atlassian.jira.plu...
]
Thomas Diesler resolved JBOSGI-144.
-----------------------------------
Resolution: Done
Done
[tdiesler@tdvaio trunk]$ mvn -Dtest=ServiceFactoryUnitTestCase test
Running org.jboss.test.osgi.service.test.ServiceFactoryUnitTestCase
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.324 sec
* Framework caches service provided by the ServiceFactory
* ServiceFactory.getService/ungetService are called with the bundle which requests the
service (not the one that created it)
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:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira