ServiceTracker
class simplifies using services from the Framework's service registry. A ServiceTracker
object is constructed with search criteria and a ServiceTrackerCustomizer
object. A ServiceTracker
can use a ServiceTrackerCustomizer
to customize the service objects to be tracked. The ServiceTracker
can then be opened to begin tracking all services in the Framework's service registry that match the specified search criteria. The ServiceTracker
correctly handles all of the details of listening to ServiceEvent
s and getting and ungetting services.
The getServiceReferences
method can be called to get references to the services being tracked. The getService
and getServices
methods can be called to get the service objects for the tracked service.
The ServiceTracker
class is thread-safe. It does not call a ServiceTrackerCustomizer
while holding any locks. ServiceTrackerCustomizer
implementations must also be thread-safe.
@ThreadSafe
@version $Revision: 6386 $
|
|