Class ThreadClassLoaderManager


  • public final class ThreadClassLoaderManager
    extends Object
    Provides a for managing the thread-local class loader
    • Method Detail

      • getInstance

        public static ThreadClassLoaderManager getInstance()
        Returns the thread-local instance of the manager
        Returns:
        the thread-local instance of the manager
      • clearInstance

        public static void clearInstance()
        Clear the thread-local instance of the manager.
      • pushClassLoader

        public void pushClassLoader​(ClassLoader loader)
        Sets the given loader as the thread-local classloader.
        Parameters:
        loader - The class loader. May be null.
      • popClassLoader

        public void popClassLoader()
        Restores the previous loader as the thread-local classloader.
      • popAll

        public List<ClassLoader> popAll()
        Hack for OIM. See BundleClassLoader. Pops and returns all class loaders previously pushed, therefore effectively setting the thread's current context class loader to the initial class loader.
      • pushAll

        public void pushAll​(List<ClassLoader> loaders)
        Hack for OIM. See BundleClassLoader. Pushes all class loaders in the list as the context class loader.
        Parameters:
        loaders - the loaders to push; never null.
      • getCurrentClassLoader

        public ClassLoader getCurrentClassLoader()
        Returns the current thread-local class loader
        Returns:
        the current thread-local class loader