Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[type:feature] Custome classloader hot load plugins to gateway. #5403

Open
wants to merge 134 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
6e90c09
test
lahmXu Sep 13, 2023
6cff152
合并AbstractShenyuClassIsolation到AbstractShenyuPlugin类中
lahmXu Sep 14, 2023
3606286
调整代码
lahmXu Sep 17, 2023
3d5392e
加载插件到spring bean中
lahmXu Sep 19, 2023
2132596
fix
lahmXu Sep 21, 2023
25de55e
fix
lahmXu Sep 21, 2023
2c3fd4d
添加maven打包plugin配置,通过includeArtifactIds可以将需要的依赖放到自定义类加载器中
lahmXu Sep 25, 2023
2cf80d8
排除报错依赖
lahmXu Sep 27, 2023
6797b15
记录当前修改
lahmXu Oct 9, 2023
d9b2654
修复motan初始化失败问题
lahmXu Oct 13, 2023
e8e485a
解决序列化sofa请求参数失败问题
lahmXu Oct 16, 2023
16c41ab
feat: 将插件需要创建的对象交给spring去创建
lahmXu Oct 18, 2023
2a7e14d
feat: 增加releasa打包
lahmXu Oct 22, 2023
426cf37
[type:fix] refactor class isolation.
Oct 24, 2023
761ee11
Merge branch 'apache:master' into class_isolation
lahmXu Oct 24, 2023
303a704
[type:fix] refactor class isolation.
Oct 24, 2023
6729ebd
Merge remote-tracking branch 'lamuxu/class_isolation' into class_isol…
Oct 24, 2023
194e0f5
[type:fix] refactor class isolation.
Oct 24, 2023
fba3c97
[type:fix] refactor class isolation.
Oct 25, 2023
07600ca
[type:fix] refactor class isolation.
Oct 26, 2023
a55abe1
[type:fix] refactor class isolation.
Oct 26, 2023
ca78bcf
[type:fix] refactor class isolation.
Oct 26, 2023
62d12d5
fix: 增加motan插件
lahmXu Oct 26, 2023
ae8d6ab
[type:fix] refactor class isolation.
Oct 27, 2023
84dd81f
fix: 修改motan插件
lahmXu Oct 31, 2023
f98af5c
fix: 修改motan插件
lahmXu Oct 31, 2023
9e14994
Merge branch 'apache:master' into class_isolation
lahmXu Oct 31, 2023
746c65a
feat: 增加插件通用lib目录,增加maven构建时移除jar文件的功能
lahmXu Nov 3, 2023
f3e6760
feat: 改写request插件
lahmXu Nov 9, 2023
68d79f9
fix: 调整motan、sofa插件打包配置
lahmXu Nov 9, 2023
1cea6c0
fix: 调整motan插件
lahmXu Nov 16, 2023
6037fca
fix: 调整sofa插件
lahmXu Nov 17, 2023
b06629b
fix: 调整sofa插件
lahmXu Nov 20, 2023
e7eb2db
fix: 修复fatjar中包含多个pom.properties的问题
lahmXu Nov 29, 2023
3a278a1
fix: 加入motan-api依赖
lahmXu Nov 30, 2023
aab516b
Merge branch 'apache:master' into class_isolation
lahmXu Dec 7, 2023
91e3efb
fix: 开启motan、sofa插件的e2e测试
lahmXu Dec 26, 2023
ce56e38
fix: 调整e2e测试配置
lahmXu Dec 26, 2023
b4ce158
fix: 调整e2e测试配置
lahmXu Dec 26, 2023
23e701e
fix: 调整e2e测试配置
lahmXu Dec 26, 2023
d861c3e
fix: 修复checkstyle问题
lahmXu Dec 26, 2023
46351d6
fix: 开启motan e2e测试
lahmXu Dec 27, 2023
96d4781
fix: 修改motan插件的e2e测试
lahmXu Dec 28, 2023
5987a73
fix: 修改motan插件的e2e测试
lahmXu Dec 28, 2023
6fdedec
fix: 修改motan插件的e2e测试
lahmXu Dec 28, 2023
e1e358c
fix: 开启motan e2e测试
lahmXu Dec 28, 2023
b51f8af
fix: 开启motan e2e测试
lahmXu Dec 28, 2023
54b7904
fix: 修改motan插件的e2e测试
lahmXu Dec 28, 2023
46f6d92
fix: 修改motan插件的e2e测试
lahmXu Dec 28, 2023
bcf69d9
fix: 调整motan e2e测试
lahmXu Dec 28, 2023
55f9dde
fix: 修改motan插件的e2e测试
lahmXu Dec 28, 2023
ac92bb4
fix: 修改motan插件的e2e测试
lahmXu Dec 29, 2023
07918b1
fix: 修改motan插件的e2e测试
lahmXu Dec 29, 2023
5a979de
fix: 修改motan插件的e2e测试
lahmXu Dec 29, 2023
824bfcb
fix: 修改motan插件的e2e测试
lahmXu Dec 29, 2023
1161706
fix: 修改motan插件的e2e测试
lahmXu Dec 29, 2023
9976f94
fix: 修改motan插件的e2e测试
lahmXu Dec 29, 2023
0dea96b
fix: 修改motan插件的e2e测试
lahmXu Dec 29, 2023
6dfeb31
fix: 调整motan e2e测试
lahmXu Dec 30, 2023
350a945
fix: 修改motan插件的e2e测试
lahmXu Dec 30, 2023
a2b8936
fix: 修改motan插件的e2e测试
lahmXu Dec 30, 2023
3875a0c
fix: 修改motan插件的e2e测试
lahmXu Jan 9, 2024
ec2bfd2
fix: 修改motan插件的e2e测试
lahmXu Jan 9, 2024
d387a34
fix: 修改motan插件的e2e测试
lahmXu Jan 9, 2024
8744738
fix: 修改motan插件的e2e测试
lahmXu Jan 9, 2024
95cb3a6
fix: 修改motan插件的e2e测试
lahmXu Jan 10, 2024
d8b59e6
fix: 修改motan插件的e2e测试
lahmXu Jan 10, 2024
21d6e52
fix: 调整motan e2e测试
lahmXu Jan 10, 2024
3b48b63
feat: 合并代码
lahmXu Jan 11, 2024
52fce52
fix: 测试sofa e2e测试
lahmXu Jan 11, 2024
0a4ac1a
fix: 修改motan插件的e2e测试
lahmXu Jan 11, 2024
f128ce3
fix: 解决motan NoClassDefFoundError
lahmXu Jan 12, 2024
5ab2a77
fix: 修改motan插件的e2e测试
lahmXu Jan 12, 2024
2068aa6
fix: 修改motan插件的e2e测试
lahmXu Jan 12, 2024
fab3b73
fix: 修改motan插件的e2e测试
lahmXu Jan 12, 2024
232419e
fix: 修改motan插件的e2e测试
lahmXu Jan 12, 2024
5e7f0e8
fix: 修改motan插件的e2e测试
lahmXu Jan 12, 2024
2ba5986
fix: 打印endpoint日志
lahmXu Jan 13, 2024
70cc749
fix: 修改motan插件的e2e测试
lahmXu Jan 13, 2024
11030c8
fix: 修改motan插件的e2e测试
lahmXu Jan 15, 2024
6c0bad2
fix: 移除sofa、motan插件依赖
lahmXu Jan 15, 2024
7a1769e
fix: 修改sofa插件的e2e测试
lahmXu Jan 16, 2024
db4eee6
fix: 恢复shenyu git action配置
lahmXu Jan 17, 2024
c4e0938
fix: 恢复shenyu git action配置
lahmXu Jan 17, 2024
c0041a1
fix: 修复格式问题
lahmXu Jan 17, 2024
37050fc
fix: 修复格式问题
lahmXu Jan 17, 2024
ca0bf41
fix: 修复actions失败问题
lahmXu Jan 17, 2024
cab1654
fix: 修复actions失败问题
lahmXu Jan 17, 2024
46c7d91
fix: 修复actions失败问题
lahmXu Jan 17, 2024
e1da7f7
Merge branch 'master' into class_isolation
lahmXu Jan 17, 2024
7237fb4
fix: 修复actions失败问题
lahmXu Jan 18, 2024
cca9d2f
fix: 修复actions失败问题
lahmXu Jan 18, 2024
f958688
fix: 修复actions失败问题
lahmXu Jan 18, 2024
b3ae051
fix: 修复actions失败问题
lahmXu Jan 18, 2024
e7a17df
fix: 修复actions失败问题
lahmXu Jan 18, 2024
0daa58a
fix: 修复actions失败问题
lahmXu Jan 18, 2024
3e49b64
fix: 修复actions失败问题
lahmXu Jan 18, 2024
095c7b5
fix: 修复actions失败问题
lahmXu Jan 18, 2024
fc3fdeb
fix: 修复actions失败问题
lahmXu Jan 18, 2024
0705196
fix: 修复actions失败问题
lahmXu Jan 18, 2024
a54ef32
fix: 修复actions失败问题
lahmXu Jan 18, 2024
69caeaa
fix: 修复actions失败问题
lahmXu Jan 18, 2024
cd11b5b
fix: 修复actions失败问题
lahmXu Jan 22, 2024
fe3f057
fix: 合并master代码
lahmXu Jan 22, 2024
4d5cb41
fix: 合并master代码
lahmXu Jan 22, 2024
26f1e20
Merge branch 'master' into class_isolation
loongs-zhang Jan 22, 2024
8e30a51
fix: 合并master代码
lahmXu Feb 1, 2024
91d4cb1
fix: 调整shenyu-integrated-test-k8s-ingress-motan测试启动脚本
lahmXu Feb 1, 2024
b04a9a9
fix: 调整shenyu-integrated-test-k8s-ingress-motan测试启动脚本
lahmXu Feb 1, 2024
972b39c
fix: 调整shenyu-integrated-test-k8s-ingress-motan测试启动脚本
lahmXu Feb 1, 2024
8262cbf
fix: 调整代码
lahmXu Feb 28, 2024
f181162
fix: 调整代码
lahmXu Feb 28, 2024
1620f29
fix: 调整代码
lahmXu Feb 28, 2024
ed5b0b0
fix: 调整代码
lahmXu Feb 28, 2024
0fa97ca
fix: 修复格式问题
lahmXu Mar 4, 2024
914d7c8
Merge branch 'master' into class_isolation
lahmXu Mar 10, 2024
9827562
fix: 移除健康检查
lahmXu Mar 24, 2024
298b5a6
Merge branch 'master' into class_isolation
lahmXu Mar 24, 2024
198f193
fix: 合并代码
lahmXu Mar 24, 2024
a4b07bd
fix: 合并代码
lahmXu Mar 25, 2024
3246f39
fix: 合并代码
lahmXu Apr 1, 2024
8b2f414
fix: 移除isolation依赖,使用父加载器加载
lahmXu Apr 2, 2024
c599f37
feat: 合并代码
lahmXu Apr 2, 2024
774038f
fix: 移除 motan 依赖
lahmXu Apr 2, 2024
1924fb9
fix: 添加 sofa 版本
lahmXu Apr 2, 2024
eae5d7d
fix: 调整 motan 健康检测路径
lahmXu Apr 3, 2024
cccfd0b
fix: 移除健康检查
lahmXu Apr 3, 2024
6846805
fix: 移除健康检查
lahmXu Apr 3, 2024
9be7ff3
Merge branch 'master' into class_isolation
lahmXu Apr 15, 2024
506b34e
fix: 修复sofa单测问题
lahmXu Apr 17, 2024
0530f8e
Merge branch 'class_isolation' of https://github.com/lahmXu/shenyu in…
lahmXu Apr 17, 2024
0c8d0a5
fix: 解决冲突
lahmXu Apr 17, 2024
0f08c41
Merge branch 'master' of https://github.com/apache/shenyu into class_…
lahmXu Apr 20, 2024
a475652
fix: 修复缺少jakarta问题
lahmXu Apr 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
lahmXu committed Sep 21, 2023
commit 2132596b33afdb30e9484083c50d5dca13d8e488
Original file line number Diff line number Diff line change
@@ -247,7 +247,6 @@ private void initPluginClassLoader(String pluginName) {
LOG.error("failed to find plugin: {}", pluginName);
return;
}
plugin.setClassLoader(pluginClassLoader);

// 将 class 加入到 spring bean 中去
shenyuLoaderService.loaderPlugins(plugin.getRegisterClassNames(), pluginClassLoader);
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
import org.apache.shenyu.common.dto.PluginData;
import org.apache.shenyu.plugin.api.ShenyuPlugin;
import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
import org.apache.shenyu.plugin.base.AbstractShenyuPlugin;
import org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber;
import org.apache.shenyu.plugin.base.handler.PluginDataHandler;
import org.apache.shenyu.web.handler.ShenyuWebHandler;
@@ -36,6 +37,7 @@

import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.net.URLClassLoader;
import java.util.*;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -124,19 +126,20 @@ public void loaderPlugins(final List<ShenyuLoaderResult> results) {
subscriber.putExtendPluginDataHandler(handlers);
}

public void loaderPlugins(final List<String> registerClassNames, ClassLoader classLoader) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
public void loaderPlugins(final List<String> registerClassNames, URLClassLoader classLoader) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
if (Objects.isNull(registerClassNames)) {
return;
}

for (String className : registerClassNames) {
Class<?> clazz = Class.forName(className, false, classLoader);
if (ShenyuPlugin.class.isAssignableFrom(clazz)) {
List<ShenyuPlugin> pluginList = Arrays.asList(getOrCreateSpringBean(className, classLoader));
webHandler.putExtPlugins(pluginList);
AbstractShenyuPlugin plugin = getOrCreateSpringBean(className, classLoader);
plugin.setClassLoader(classLoader);
webHandler.putExtPlugins(Arrays.asList(plugin));
} else if (PluginDataHandler.class.isAssignableFrom(clazz)) {
List<PluginDataHandler> handlerList = Arrays.asList(getOrCreateSpringBean(className, classLoader));
subscriber.putExtendPluginDataHandler(handlerList);
PluginDataHandler pluginDataHandler = getOrCreateSpringBean(className, classLoader);
subscriber.putExtendPluginDataHandler(Arrays.asList(pluginDataHandler));
}
}
}