Class OsgiProxyFactory


  • public class OsgiProxyFactory
    extends Object
    A factory to produce proxy for OSGi services.
    Since:
    8.6
    • Constructor Detail

      • OsgiProxyFactory

        public OsgiProxyFactory()
    • Method Detail

      • createProxy

        public static <T> T createProxy​(Class<T> interfaceType,
                                        Supplier<org.osgi.util.tracker.ServiceTracker> serviceTrackerSupplier)
        Provides a proxy of the given interface T that is backed by the OSGi service from the provided service tracker. The provided implementation will fail fast if the service is not available - it will NOT wait for the service to become available.

        It is expected callers will use this method to obtain services that they will invoke later in response to user activity. Invoking methods on returned proxy immediately will probably not work, unless you know what you're doing.