Class SortingServiceTracker<T>
- All Implemented Interfaces:
ServiceTrackerCustomizer<T,T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddingService(ServiceReference<T> reference) Default implementation of theServiceTrackerCustomizer.addingServicemethod.Return a sorted list of the services references.Return a sorted list of the services.voidmodifiedService(ServiceReference<T> reference, T service) Default implementation of theServiceTrackerCustomizer.modifiedServicemethod.voidremovedService(ServiceReference<T> reference, T service) Default implementation of theServiceTrackerCustomizer.removedServicemethod.Methods inherited from class org.osgi.util.tracker.ServiceTracker
close, getService, getService, getServiceReference, getServiceReferences, getServices, getServices, getTracked, getTrackingCount, isEmpty, open, open, remove, size, waitForService
-
Constructor Details
-
SortingServiceTracker
Constructor- Parameters:
context- Bundle contextclazz- Class
-
-
Method Details
-
removedService
Description copied from class:ServiceTrackerDefault implementation of theServiceTrackerCustomizer.removedServicemethod.This method is only called when this
ServiceTrackerhas been constructed with anull ServiceTrackerCustomizerargument.This implementation calls
ungetService, on theBundleContextwith which thisServiceTrackerwas created, passing the specifiedServiceReference.This method can be overridden in a subclass. If the default implementation of
addingServicemethod was used, this method must unget the service.- Specified by:
removedServicein interfaceServiceTrackerCustomizer<T,T> - Overrides:
removedServicein classServiceTracker<T,T> - Parameters:
reference- The reference to removed service.service- The service object for the removed service.- See Also:
-
modifiedService
Description copied from class:ServiceTrackerDefault implementation of theServiceTrackerCustomizer.modifiedServicemethod.This method is only called when this
ServiceTrackerhas been constructed with anull ServiceTrackerCustomizerargument.This implementation does nothing.
- Specified by:
modifiedServicein interfaceServiceTrackerCustomizer<T,T> - Overrides:
modifiedServicein classServiceTracker<T,T> - Parameters:
reference- The reference to modified service.service- The service object for the modified service.- See Also:
-
addingService
Description copied from class:ServiceTrackerDefault implementation of theServiceTrackerCustomizer.addingServicemethod.This method is only called when this
ServiceTrackerhas been constructed with anull ServiceTrackerCustomizerargument.This implementation returns the result of calling
getService, on theBundleContextwith which thisServiceTrackerwas created, passing the specifiedServiceReference.This method can be overridden in a subclass to customize the service object to be tracked for the service being added. In that case, take care not to rely on the default implementation of
removedServiceto unget the service.- Specified by:
addingServicein interfaceServiceTrackerCustomizer<T,T> - Overrides:
addingServicein classServiceTracker<T,T> - Parameters:
reference- The reference to the service being added to thisServiceTracker.- Returns:
- The service object to be tracked for the service added to this
ServiceTracker. - See Also:
-
getSortedServices
Return a sorted list of the services.- Returns:
- Service list
-
getSortedServiceReferences
Return a sorted list of the services references.- Returns:
- Service list
-