通过Java定时任务,取消Greenplum慢查询,解决查询阻塞问题!!!
package cn.xhh.task;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.core.CallableStatementCallback;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class AutoCancelSlowSql {
@Resource
private JdbcTemplate redshiftJdbcTemplate;
@Resource
private JdbcTemplate mysqlJdbcTemplate;
@PostConstruct
public void init() {
execute();
log.info("定时取消慢查询任务开始执行