Class DefaultServiceTracker

  • All Implemented Interfaces:
    ServiceTracker

    public class DefaultServiceTracker
    extends java.lang.Object
    implements ServiceTracker
    Maintains sessions for each service being tracked. Most of the work is delegated to the FilterWatcher: when the results of a filter change, we re-evaluate the state and issue callback accordingly.
    Author:
    jwhite
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setFilterWatcher​(FilterWatcher filterWatcher)  
      java.io.Closeable trackService​(java.lang.String serviceName, ServiceTracker.ServiceListener listener)
      Issues callbacks to the given listener for services that: 1) Have the given service name Callbacks are expected to be issued immediately for all existing services that match the criteria.
      java.io.Closeable trackServiceMatchingFilterRule​(java.lang.String serviceName, java.lang.String filterRule, ServiceTracker.ServiceListener listener)
      Issues callbacks to the given listener for services that: 1) Have the given service name 2) Match the given filter rule Callbacks are expected to be issued immediately for all existing services that match the criteria.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultServiceTracker

        public DefaultServiceTracker()
    • Method Detail

      • trackServiceMatchingFilterRule

        public java.io.Closeable trackServiceMatchingFilterRule​(java.lang.String serviceName,
                                                                java.lang.String filterRule,
                                                                ServiceTracker.ServiceListener listener)
        Description copied from interface: ServiceTracker
        Issues callbacks to the given listener for services that: 1) Have the given service name 2) Match the given filter rule Callbacks are expected to be issued immediately for all existing services that match the criteria. Additional callback will be made as services are added/removed.
        Specified by:
        trackServiceMatchingFilterRule in interface ServiceTracker
        Parameters:
        serviceName - only interfaces with the given service name attached will be considered
        filterRule - only interfaces that match the given filter will be considered if null, or empty the filter will match everything
        listener - used for callbacks
        Returns:
        close when done watching
      • trackService

        public java.io.Closeable trackService​(java.lang.String serviceName,
                                              ServiceTracker.ServiceListener listener)
        Description copied from interface: ServiceTracker
        Issues callbacks to the given listener for services that: 1) Have the given service name Callbacks are expected to be issued immediately for all existing services that match the criteria. Additional callback will be made as services are added/removed.
        Specified by:
        trackService in interface ServiceTracker
        Parameters:
        serviceName - only interfaces with the given service name attached will be considered
        listener - used for callbacks
        Returns:
        close when done watching
      • setFilterWatcher

        public void setFilterWatcher​(FilterWatcher filterWatcher)