Module org.elasticsearch.xcore
Class RestorableContextClassLoader
java.lang.Object
org.elasticsearch.xpack.core.security.support.RestorableContextClassLoader
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionRestorableContextClassLoader(Class<?> fromClass) RestorableContextClassLoader(Thread thread, ClassLoader setClassLoader) -
Method Summary
-
Constructor Details
-
RestorableContextClassLoader
- Throws:
PrivilegedActionException
-
RestorableContextClassLoader
public RestorableContextClassLoader(Thread thread, ClassLoader setClassLoader) throws PrivilegedActionException - Throws:
PrivilegedActionException
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
PrivilegedActionException
-