August 2001
Intermediate to advanced
480 pages
9h 14m
English
public interface ServiceFactory
Service factories allow services to provide customized service objects. In order to gain control over the specific service object given to a bundle using the service, a bundle programmer can register a ServiceFactory object instead of a service object when registering a service.
When this is done, the BundleContext.getService(ServiceReference) method calls the service factory's getService(Bundle, ServiceRegistration) to create a service object specifically for the requesting bundle. The service object returned by the service factory is cached by the framework until the bundle releases its use of the service.
When the bundle's use count for the service drops to zero (including ...
Read now
Unlock full access