When registering a service, a {@code ServiceFactory} object can be usedinstead of a service object, so that the module developer can gain control of the specific service object granted to a module that is using the service.
When this happens, the {@code ModuleContext.getService(ServiceReference)}method calls the {@code ServiceFactory.getService} method to create a serviceobject specifically for the requesting module. The service object returned by the {@code ServiceFactory} is cached by the Runtime until the modulereleases its use of the service.
When the module's use count for the service is decremented to zero (including the module stopping or the service being unregistered), the {@code ServiceFactory.ungetService} method is called.
{@code ServiceFactory} objects are only used by the Runtime and are notmade available to other modules in the environment. The Runtime may concurrently call a {@code ServiceFactory}. @param < S> Type of Service @author thomas.diesler@jboss.com @since 27-Sep-2013 @see ModuleContext#getService(ServiceReference) @ThreadSafe
|
|
|
|
|
|