Package org.apache.pulsar.broker
Class ClassLoaderSwitcher
- java.lang.Object
-
- org.apache.pulsar.broker.ClassLoaderSwitcher
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ClassLoaderSwitcher extends java.lang.Object implements java.lang.AutoCloseableHelp to switch the class loader of current thread to the NarClassLoader, and change it back when it's done. With the help of try-with-resources statement, the code would be cleaner than using try finally every time.
-
-
Constructor Summary
Constructors Constructor Description ClassLoaderSwitcher(java.lang.ClassLoader classLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()
-