T - Type of Service.public interface ServiceRegistration<T>
The Runtime returns a ServiceRegistration object when a
ModuleContext.registerService method invocation is successful. The
ServiceRegistration object is for the private use of the registering
module and should not be shared with other modules.
The ServiceRegistration object may be used to update the properties
of the service or to unregister the service.
ModuleContext.registerService(String[],Object,Dictionary)| Modifier and Type | Method and Description |
|---|---|
ServiceReference<T> |
getReference()
Returns a
ServiceReference object for a service being registered. |
void |
setProperties(Dictionary<String,?> properties)
Updates the properties associated with a service.
|
void |
unregister()
Unregisters a service.
|
ServiceReference<T> getReference()
ServiceReference object for a service being registered.
The ServiceReference object may be shared with other modules.
ServiceReference object.IllegalStateException - If this ServiceRegistration object
has already been unregistered.void setProperties(Dictionary<String,?> properties)
The Constants.OBJECTCLASS and Constants.SERVICE_ID keys
cannot be modified by this method. These values are set by the Runtime
when the service is registered.
The following steps are required to modify service properties:
ServiceEvent.MODIFIED is fired.
properties - The properties for this service. See Constants
for a list of standard service property keys. Changes should not
be made to this object after calling this method. To update the
service's properties this method should be called again.IllegalStateException - If this ServiceRegistration object
has already been unregistered.IllegalArgumentException - If properties contains case
variants of the same key name.void unregister()
ServiceRegistration object from
the Runtime service registry. All ServiceReference objects
associated with this ServiceRegistration object can no longer be
used to interact with the service once unregistration is complete.
The following steps are required to unregister a service:
ServiceEvent.UNREGISTERING is fired
so that modules using this service can release their use of the service.
Once delivery of the service event is complete, the
ServiceReference objects for the service may no longer be used to
get a service object for the service.
ServiceFactory object, the
ServiceFactory.ungetService method is called to release the
service object for the module.
IllegalStateException - If this ServiceRegistration object
has already been unregistered.ModuleContext.ungetService(ServiceReference),
ServiceFactory.ungetService(Module, ServiceRegistration, Object)Copyright © 2014 JBoss by Red Hat. All Rights Reserved.