S
- Type of Service@ProviderType public interface BeanServiceObjects<S>
A component instance can receive a BeanServiceObjects
object via a
reference that is typed BeanServiceObjects
.
For services with prototype
scope, multiple
service objects for the service can be obtained. For services with
singleton
or bundle
scope, only one, use-counted service object is available.
Any unreleased service objects obtained from this BeanServiceObjects
object are automatically released by Service Component Runtime when the
service becomes unbound.
ServiceObjects
Modifier and Type | Method and Description |
---|---|
S |
getService()
Returns a service object for the
associated service. |
ServiceReference<S> |
getServiceReference()
Returns the
ServiceReference for the service associated with this
BeanServiceObjects object. |
void |
ungetService(S service)
Releases a service object for the
associated service. |
S getService()
associated
service.
This method will always return null
when the associated service
has been become unbound.
null
if
the service is unbound, the customized service object returned by
a ServiceFactory
does not implement the classes under
which it was registered or the ServiceFactory
threw an
exception.java.lang.IllegalStateException
- If the component instance that received
this BeanServiceObjects
object
has been deactivated.ungetService(Object)
void ungetService(S service)
associated
service.
The specified service object must no longer be used and all references to it should be destroyed after calling this method.
service
- A service object previously provided by this
ReferenceServiceObjects
object.java.lang.IllegalStateException
- If the component instance that received
this ReferenceServiceObjects
object has been deactivated.java.lang.IllegalArgumentException
- If the specified service object was not
provided by this
BeanServiceObjects
object.getService()
ServiceReference<S> getServiceReference()
ServiceReference
for the service associated with this
BeanServiceObjects
object.ServiceReference
for the service associated with this
BeanServiceObjects
object.Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0