Class RestorableContextClassLoader

java.lang.Object
org.elasticsearch.xpack.core.security.support.RestorableContextClassLoader
All Implemented Interfaces:
AutoCloseable

public class RestorableContextClassLoader extends Object implements AutoCloseable
A try-with-resource compatible object for configuring a thread Thread.getContextClassLoader(). On construction this class will set the current (or provided) thread's context class loader. On close(), it restores the previous value of the class loader.
  • Constructor Details

    • RestorableContextClassLoader

      public RestorableContextClassLoader(Class<?> fromClass)
    • RestorableContextClassLoader

      public RestorableContextClassLoader(Thread thread, ClassLoader setClassLoader)
  • Method Details