Browse Source

Fix hive datasource connection leak (#12226)

3.2.0-release
Wenjun Ruan 2 years ago committed by GitHub
parent
commit
0a44107bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java

10
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java

@ -45,6 +45,7 @@ import java.util.concurrent.TimeUnit;
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 @@ public class HiveDataSourceClient extends CommonDataSourceClient {
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 class HiveDataSourceClient extends CommonDataSourceClient {
@Override
public void close() {
try {
super.close();
logger.info("close {}.", this.getClass().getSimpleName());
} finally {
kerberosRenewalService.shutdown();
this.ugi = null;
}
logger.info("Closed Hive datasource client.");
}
}

Loading…
Cancel
Save