|
|
@ -45,6 +45,7 @@ import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate; |
|
|
|
|
|
|
|
|
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
|
|
|
|
|
|
|
@ -81,8 +82,8 @@ public class HiveDataSourceClient extends CommonDataSourceClient { |
|
|
|
this.ugi = createUserGroupInformation(baseConnectionParam.getUser()); |
|
|
|
this.ugi = createUserGroupInformation(baseConnectionParam.getUser()); |
|
|
|
logger.info("Create ugi success."); |
|
|
|
logger.info("Create ugi success."); |
|
|
|
|
|
|
|
|
|
|
|
super.initClient(baseConnectionParam, dbType); |
|
|
|
|
|
|
|
this.dataSource = JDBCDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam, dbType); |
|
|
|
this.dataSource = JDBCDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam, dbType); |
|
|
|
|
|
|
|
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|
|
|
logger.info("Init {} success.", getClass().getName()); |
|
|
|
logger.info("Init {} success.", getClass().getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -167,10 +168,13 @@ public class HiveDataSourceClient extends CommonDataSourceClient { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void close() { |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|