This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new fd905b66b0 [refactor](jdbc) close datasource if no need to maintain
the cache (#18724)
fd905b66b0 is described below
commit fd905b66b028fc5e8c98d5cbcbd8acc4854006f7
Author: zhangstar333 <[email protected]>
AuthorDate: Sat Apr 22 22:07:34 2023 +0800
[refactor](jdbc) close datasource if no need to maintain the cache (#18724)
after pr #18670
could use jvm parameters to init jdbc datasource,
but when set JDBC_MIN_POOL=0, it can be immediately closed.
There is no need to wait for the recycling timer.
---
fe/java-udf/src/main/java/org/apache/doris/udf/JdbcExecutor.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fe/java-udf/src/main/java/org/apache/doris/udf/JdbcExecutor.java
b/fe/java-udf/src/main/java/org/apache/doris/udf/JdbcExecutor.java
index c25a60dff0..17cc75b168 100644
--- a/fe/java-udf/src/main/java/org/apache/doris/udf/JdbcExecutor.java
+++ b/fe/java-udf/src/main/java/org/apache/doris/udf/JdbcExecutor.java
@@ -108,6 +108,12 @@ public class JdbcExecutor {
if (conn != null) {
conn.close();
}
+ if (minIdleSize == 0) {
+ // it can be immediately closed if there is no need to maintain
the cache of datasource
+ druidDataSource.close();
+ JdbcDataSource.getDataSource().getSourcesMap().clear();
+ druidDataSource = null;
+ }
resultSet = null;
stmt = null;
conn = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]