diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java index 0cef82c1b5d8..d076e81c9aad 100644 --- a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java @@ -45,6 +45,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.JdbcTemplate; import com.google.common.util.concurrent.ThreadFactoryBuilder; @@ -79,8 +80,8 @@ protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType this.ugi = createUserGroupInformation(baseConnectionParam.getUser()); logger.info("Create ugi success."); - super.initClient(baseConnectionParam, dbType); this.dataSource = JDBCDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam, dbType); + this.jdbcTemplate = new JdbcTemplate(dataSource); logger.info("Init {} success.", getClass().getName()); } @@ -166,10 +167,13 @@ public Connection getConnection() { @Override public void close() { - super.close(); + try { + super.close(); + } finally { + kerberosRenewalService.shutdown(); + this.ugi = null; + } + logger.info("Closed Hive datasource client."); - logger.info("close {}.", this.getClass().getSimpleName()); - kerberosRenewalService.shutdown(); - this.ugi = null; } }