Package org.osgi.service.cdi.reference
Interface BeanServiceObjects<S>
-
- Type Parameters:
S- Type of Service
@ProviderType public interface BeanServiceObjects<S>Allows multiple service objects for a service to be obtained.A component instance can receive a
BeanServiceObjectsobject via a reference that is typedBeanServiceObjects.For services with
prototypescope, multiple service objects for the service can be obtained. For services withsingletonorbundlescope, only one, use-counted service object is available.Any unreleased service objects obtained from this
BeanServiceObjectsobject are automatically released by Service Component Runtime when the service becomes unbound.- Author:
- $Id: d70d307f6f29530af477c6248fb57fd6df7bf1e3 $
- See Also:
ServiceObjects
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SgetService()Returns a service object for theassociatedservice.org.osgi.framework.ServiceReference<S>getServiceReference()Returns theServiceReferencefor the service associated with thisBeanServiceObjectsobject.voidungetService(S service)Releases a service object for theassociatedservice.
-
-
-
Method Detail
-
getService
S getService()
Returns a service object for theassociatedservice.This method will always return
nullwhen the associated service has been become unbound.- Returns:
- A service object for the associated service or
nullif the service is unbound, the customized service object returned by aServiceFactorydoes not implement the classes under which it was registered or theServiceFactorythrew an exception. - Throws:
java.lang.IllegalStateException- If the component instance that received thisBeanServiceObjectsobject has been deactivated.- See Also:
ungetService(Object)
-
ungetService
void ungetService(S service)
Releases a service object for theassociatedservice.The specified service object must no longer be used and all references to it should be destroyed after calling this method.
- Parameters:
service- A service object previously provided by thisReferenceServiceObjectsobject.- Throws:
java.lang.IllegalStateException- If the component instance that received thisReferenceServiceObjectsobject has been deactivated.java.lang.IllegalArgumentException- If the specified service object was not provided by thisBeanServiceObjectsobject.- See Also:
getService()
-
getServiceReference
org.osgi.framework.ServiceReference<S> getServiceReference()
Returns theServiceReferencefor the service associated with thisBeanServiceObjectsobject.- Returns:
- The
ServiceReferencefor the service associated with thisBeanServiceObjectsobject.
-
-