Class ParentLastClassloader

java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.qubership.atp.environments.db.migration.classloader.ParentLastClassloader
All Implemented Interfaces:
Closeable, AutoCloseable

public class ParentLastClassloader extends URLClassLoader
  • Constructor Details

    • ParentLastClassloader

      public ParentLastClassloader(String sourcePath, String jdbcType)
      ClassLoader based on URLClassLoader for loading classes from self. In case class not found in this CL, it will try to load it from parent CL.
      Parameters:
      sourcePath - - location of resources. update.xml, migration scripts/jars etc. For example: ./scripts/
      jdbcType - - type of database. This parameter need for loading generated q-classes. If you want use postgres database, and your jar with classes has name env-q-classes-generation-pg.jar, then you must define jdbcType=pg When CL trying to load jar, it split the name on three parts: 1. general name = env-q-classes-generation 2. suffix = pg 3. extension = .jar The suffix must match to jdbcType for loading this jar. So, you can check how it works in method getUrlClassLoader(List).
  • Method Details

    • getResources

      public Enumeration<URL> getResources(String name) throws IOException
      Overrides:
      getResources in class ClassLoader
      Throws:
      IOException
    • loadClass

      public Class<?> loadClass(String className) throws ClassNotFoundException
      Load class from current classloader. In case the liquibase started executing new one changeset, then classloader will load compatible jars with q-classes and shaded jar with required dependencies. So, if package start with v000.TICKET671.CustomChangeSet Then classloader will load jars from sourcePath/v000/TICKET671 Which of q-classes jar will be loaded? It depends of jdbc_type.
      Overrides:
      loadClass in class ClassLoader
      Parameters:
      className - target class name.
      Returns:
      the Class
      Throws:
      ClassNotFoundException - in case Class not found in current and parent classloader.
    • refreshClassLoader

      protected void refreshClassLoader(String className)