-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
建议ExternalStoragePersistServiceImpl类实现对数据源的销毁destory操作 #8611
Labels
area/Config
good first issue
Good for newcomers
kind/enhancement
Category issues or prs related to enhancement.
Milestone
Comments
|
KomachiSion
added
status/wontfix
This will not be worked on
area/Config
status/need discuss
labels
Jun 23, 2022
或者我这么说ExternalStoragePersistServiceImpl这个类中提供了reload数据源的方法,虽然暂时没有用到,但是这个方法被多次调用时未销毁以前的数据源,可能为未来留下隐患吧,我想是不是可以在这个方法实现内部去判断,如果之前有数据源就先调用待实现的close数据源方法,在进行加载 |
您真的认真阅读代码了吗? reload中会关闭就数据源
|
老哥啊,你这个代码在哪个文件的第几行啊,找了一圈也没有看见啊 |
哦, 好像是缺少了。 我看的是别的分支。 develop分支没有。 |
KomachiSion
added
kind/enhancement
Category issues or prs related to enhancement.
and removed
status/wontfix
This will not be worked on
labels
Jun 27, 2022
KomachiSion
added
good first issue
Good for newcomers
and removed
status/need discuss
labels
Sep 19, 2022
KomachiSion
added a commit
to KomachiSion/nacos
that referenced
this issue
Sep 26, 2022
5 tasks
KomachiSion
added a commit
that referenced
this issue
Sep 26, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/Config
good first issue
Good for newcomers
kind/enhancement
Category issues or prs related to enhancement.
当前可能存在的问题
nacos-config模块中的ExternalStoragePersistServiceImpl类在启动时调用了如下代码创建了数据源,并在内存中维护了数据源对象
dataSourceService = DynamicDataSource.getInstance().getDataSource();
但是,并没有一个地方去销毁这些创建的数据源,在某些容器上重新启动或重新加载当前项目时,可能数据源未执行销毁操作,导致数据库连接处于占用问题。
我思考的解决办法
1、建议在ExternalDataSourceServiceImpl类中提供销毁数据源链接的方法 ,以实现对如下代码的资源关闭。
private List dataSourceList = new ArrayList<>();
2、建议在ExternalStoragePersistServiceImpl实现spring destory生命周期方法,并调用dataSourceService中维护的关闭方法
如果认为这个可以进行优化,我是否可以下载代码并提交一个PR呢
The text was updated successfully, but these errors were encountered: