From 57be5fa982da316ddfe9682c72c228994d5d17e0 Mon Sep 17 00:00:00 2001 From: rinoux Date: Wed, 27 Apr 2022 10:28:17 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-69942=20=E6=9B=B4=E6=96=B0Druid=E5=88=B0?= =?UTF-8?q?1.2.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../druid/util/ClassLoaderFactory.java | 34 +++++++++++++++++++ .../alibaba/druid/util/ClassLoaderHelper.java | 12 +++++++ 2 files changed, 46 insertions(+) create mode 100644 fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderFactory.java create mode 100644 fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderHelper.java diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderFactory.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderFactory.java new file mode 100644 index 000000000..1a9eb4518 --- /dev/null +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderFactory.java @@ -0,0 +1,34 @@ +package com.fr.third.alibaba.druid.util; + +import java.util.ArrayList; +import java.util.List; + +/** + * @deprecated 1.2.9版本已删除,FR的com.fr.data.pool.DataSourceFactory依赖了,实际上没地方用到,为了兼容性暂时不删 + */ +@Deprecated +public class ClassLoaderFactory { + + private static List helpers = new ArrayList(); + + public static void registerCLassLoaderHelper(ClassLoaderHelper helper) { + if(helper != null){ + helpers.add(helper); + } + } + + + public static Class loadClass(String className) throws ClassNotFoundException { + for(ClassLoaderHelper helper : helpers) { + try { + Class clazz = helper.loadClass(className); + if(clazz != null){ + return clazz; + } + } catch (ClassNotFoundException e) { + // skip + } + } + throw new ClassNotFoundException(className); + } +} \ No newline at end of file diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderHelper.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderHelper.java new file mode 100644 index 000000000..d7372493e --- /dev/null +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/util/ClassLoaderHelper.java @@ -0,0 +1,12 @@ +package com.fr.third.alibaba.druid.util; + + +/** + * @deprecated 1.2.9版本已删除,FR的com.fr.data.pool.DataSourceFactory依赖了,实际上没地方用到,为了兼容性暂时不删 + */ +@Deprecated +public interface ClassLoaderHelper { + + Class loadClass(String className) throws ClassNotFoundException; + +} \ No newline at end of file