Class TracerResolver


  • public abstract class TracerResolver
    extends Object
    TracerResolver API definition looks for one or more registered TracerResolver implementations using the ServiceLoader.

    If no TracerResolver implementations are found, the resolveTracer() method will fallback to ServiceLoader lookup of the Tracer service itself.

    Available TracerConverter implementations are applied to the resolved Tracer instance.

    None of this happens if there is an existing GlobalTracer explicit registration. That will always be returned (as-is) by the resolver, if available.

    Author:
    Sjoerd Talsma
    • Constructor Detail

      • TracerResolver

        public TracerResolver()
    • Method Detail

      • resolve

        @Deprecated
        protected abstract io.opentracing.Tracer resolve()
        Deprecated.
        Tracers are encouraged to use the TracerFactory interface to provide tracers
        Resolves the Tracer implementation.
        Returns:
        The resolved Tracer or null if none was resolved.
      • resolveTracer

        public static io.opentracing.Tracer resolveTracer()
        Attempts to resolve a Tracer via ServiceLoader using a variety of mechanisms, from the most recommended to the least recommended:

        Whenever a Tracer can be resolved by any of the methods above, the resolution stops. It means that if a Factory is found, no Resolvers are attempted to be loaded.

        If a GlobalTracer has been previously registered, it will be returned before attempting to resolve a Tracer on our own.

        If more than one TracerFactory or TracerResolver is found, the one with the highest priority is returned. Note that if a TracerResolver has a higher priority than all available TracerFactory, the factory still wins.

        Returns:
        The resolved Tracer or null if none was resolved.
      • resolveTracer

        public static io.opentracing.Tracer resolveTracer​(ClassLoader classloader)
        Attempts to resolve a Tracer via ServiceLoader using a variety of mechanisms, from the most recommended to the least recommended:

        Whenever a Tracer can be resolved by any of the methods above, the resolution stops. It means that if a Factory is found, no Resolvers are attempted to be loaded.

        If a GlobalTracer has been previously registered, it will be returned before attempting to resolve a Tracer on our own.

        If more than one TracerFactory or TracerResolver is found, the one with the highest priority is returned. Note that if a TracerResolver has a higher priority than all available TracerFactory, the factory still wins.

        Parameters:
        classloader - The class loader to be used to load provider-configuration files and provider classes, or null if the thread context class loader to be used.
        Returns:
        The resolved Tracer or null if none was resolved.
      • reload

        @Deprecated
        public static void reload()
        Deprecated.
        This method is now no-op. It's safe to just remove this method call, as there's no caching anymore.
        Reloads the lazily found resolvers and the fallback resolver.