Release Idle DataSource in Multitenant Spring application?

我怕爱的太早我们不能终老 提交于 2020-01-05 06:02:09

问题


I am working in Multi Tenant Spring Boot application. I am using the concept of one DB per Tenant approach. I have configured the dynamic database creation and connection. Also those database configurations are stored in a Map. Now I would like to implement an approach to clear DataSource which is idle for long time?


回答1:


I assume, you create Datasource and attempt to store them in a map,

whilst you create DS. you can mention

basicDataSource.setMinIdle(multitenantConnectionPoolConfig.getMinIdle());

So the connection pools ensure only active connections exist in the pool after the min Idle time expires.



来源:https://stackoverflow.com/questions/51440796/release-idle-datasource-in-multitenant-spring-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!