Class ServiceCache

  • All Implemented Interfaces:
    java.util.EventListener, org.osgi.framework.ServiceListener

    public class ServiceCache
    extends java.lang.Object
    implements org.osgi.framework.ServiceListener
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  ServiceCache.Reference  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<org.osgi.framework.ServiceReference> references
      The list of references - we don't need to synchronize this as we are running in one single request.
    • Constructor Summary

      Constructors 
      Constructor Description
      ServiceCache​(org.osgi.framework.BundleContext ctx)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()  
      <ServiceType>
      ServiceType
      getService​(java.lang.Class<ServiceType> type)
      Return a service for the given service class.
      void serviceChanged​(org.osgi.framework.ServiceEvent event)  
      • Methods inherited from class java.lang.Object

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

      • references

        protected final java.util.List<org.osgi.framework.ServiceReference> references
        The list of references - we don't need to synchronize this as we are running in one single request.
    • Constructor Detail

      • ServiceCache

        public ServiceCache​(org.osgi.framework.BundleContext ctx)
    • Method Detail

      • dispose

        public void dispose()
      • getService

        public <ServiceType> ServiceType getService​(java.lang.Class<ServiceType> type)
        Return a service for the given service class.
        Type Parameters:
        ServiceType - The service class / interface
        Parameters:
        type - The requested service
        Returns:
        The service or null
      • serviceChanged

        public void serviceChanged​(org.osgi.framework.ServiceEvent event)
        Specified by:
        serviceChanged in interface org.osgi.framework.ServiceListener
        See Also:
        ServiceListener.serviceChanged(org.osgi.framework.ServiceEvent)