Class ServiceLoaderUtil

java.lang.Object
org.apache.logging.log4j.util.ServiceLoaderUtil

@InternalApi public final class ServiceLoaderUtil extends Object
This class should be considered internal.
  • Method Details

    • loadServices

      public static <T> Stream<T> loadServices(Class<T> serviceType, MethodHandles.Lookup lookup)
      Retrieves the available services from the caller's classloader. Broken services will be ignored.
      Type Parameters:
      T - The service type.
      Parameters:
      serviceType - The class of the service.
      lookup - The calling class data.
      Returns:
      A stream of service instances.
    • loadServices

      public static <T> Stream<T> loadServices(Class<T> serviceType, MethodHandles.Lookup lookup, boolean useTccl)
      Retrieves the available services from the caller's classloader and possibly the thread context classloader. Broken services will be ignored.
      Type Parameters:
      T - The service type.
      Parameters:
      serviceType - The class of the service.
      lookup - The calling class data.
      useTccl - If true the thread context classloader will also be used.
      Returns:
      A stream of service instances.