|
|
|
@ -20,6 +20,7 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
@EnableMetrics |
|
|
|
|
public class ClassLoaderHandler extends AbstractDataSourceDriverLoader { |
|
|
|
|
private ClassLoader driverClassLoader; |
|
|
|
|
//插件获取jar的路径,和lib同级的driverlib目录
|
|
|
|
|
public static final String DRIVER_LIB_DIR = "driverlib"; |
|
|
|
|
|
|
|
|
@ -41,11 +42,14 @@ public class ClassLoaderHandler extends AbstractDataSourceDriverLoader {
|
|
|
|
|
|
|
|
|
|
@Focus(id = "com.fr.plugin.dialect.classloader.ClassLoaderHandler", text = "", source = Original.PLUGIN) |
|
|
|
|
public ClassLoader getClassLoader() { |
|
|
|
|
FineLoggerFactory.getLogger().info("====== Loading Mysql ClassLoader ... ======"); |
|
|
|
|
URL[] urls = getJarURLS(); |
|
|
|
|
ClassLoader cl = new DriverClassLoader(urls); |
|
|
|
|
Thread.currentThread().setContextClassLoader(cl); |
|
|
|
|
return cl; |
|
|
|
|
FineLoggerFactory.getLogger().info("====== Loading Hive ClassLoader ... ======"); |
|
|
|
|
synchronized (this) { |
|
|
|
|
if (this.driverClassLoader == null) { |
|
|
|
|
URL[] urls = getJarURLS(); |
|
|
|
|
this.driverClassLoader = new DriverClassLoader(urls); |
|
|
|
|
} |
|
|
|
|
return driverClassLoader; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|