Package org.apache.logging.log4j.util
Class ServiceLoaderUtil
java.lang.Object
org.apache.logging.log4j.util.ServiceLoaderUtil
This class should be considered internal.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Stream<T>
loadServices
(Class<T> serviceType, MethodHandles.Lookup lookup) Retrieves the available services from the caller's classloader.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.
-
Method Details
-
loadServices
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.
-