Class ClassLoaderSwitcher

java.lang.Object
org.apache.pulsar.broker.ClassLoaderSwitcher
All Implemented Interfaces:
AutoCloseable

public class ClassLoaderSwitcher extends Object implements AutoCloseable
Help 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 Details

    • ClassLoaderSwitcher

      public ClassLoaderSwitcher(ClassLoader classLoader)
  • Method Details