-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
是否考虑关闭数据源的时候延迟关闭数据源? #578
Comments
在进行关闭的时候可以优先考虑是否有连接正在使用,如果不存在使用的连接时可以直接关闭 |
我搞不來,靠你了 |
那等我交个PR,到时候帮忙看看 |
关闭数据源是通过Destory方法,Destory方法通过是通过ShutdownHook的逻辑执行的,ShutdownHook会在进程退出时执行同时Spring还有其他bean销毁的逻辑,所以感觉Destory使用延迟的逻辑不一定靠谱 |
我主要想解决的是在业务进行过程中动态覆盖数据源或移除时的历史数据源销毁问题,和程序关闭时的销毁不太一样,destroy的时候可以直接销毁。 |
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please fill it out carefully, or it will be closed.
请认真填写,不然会直接关闭。
Enviroment
JDK Version(required):
JDK1.8
SpringBoot Version(required):
2.6.9
dynamic-datasource-spring-boot-starter Version(required):
4.2.0,3.5.2(生产应该会用这种版本)
druid Version(optional):
Describe what happened
是否考虑关闭数据源的时候延迟关闭数据源?
Expected Result:
假定移除数据源时有连接正在使用,此时关闭将有概率导致业务失败,如果能够延迟关闭,例如延迟10s关闭,应该可以避免这种问题。我看了代码,事务这块是使用了ConnectionProxy代理的,那么理论上延迟关闭的情况下应该不会对事务产生影响。
Actual Result:
If there is an exception,or aop invalid,please attach the exception trace:
Steps to reproduce
Step 1
Step 2
Step 3
The text was updated successfully, but these errors were encountered: