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 $
A {@code ServiceTracker} object is constructed with search criteria and a{@code ServiceTrackerCustomizer} object. A {@code ServiceTracker} can use a{@code ServiceTrackerCustomizer} to customize the service objects to betracked. The {@code ServiceTracker} can then be opened to begin tracking allservices in the Framework's service registry that match the specified search criteria. The {@code ServiceTracker} correctly handles all of the details oflistening to {@code ServiceEvent}s and getting and ungetting services.
The {@code getServiceReferences} method can be called to get references tothe services being tracked. The {@code getService} and {@code getServices}methods can be called to get the service objects for the tracked service.
The {@code ServiceTracker} class is thread-safe. It does not call a{@code ServiceTrackerCustomizer} while holding any locks.{@code ServiceTrackerCustomizer} implementations must also be thread-safe. @param < S> The type of the service being tracked. @param < T> The type of the tracked object. @ThreadSafe @author $Id: a0af979aa9c88a89f220c1b2d8d7c060ced41006 $
|
|
|
|
|
|