All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lsnju.tpbase.daemon.monitor.HikariCpsMonitorTask Maven / Gradle / Ivy

There is a newer version: 2.7.14
Show newest version
package com.lsnju.tpbase.daemon.monitor;

import java.util.Collection;
import java.util.Objects;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;

import com.zaxxer.hikari.HikariDataSource;

import lombok.Setter;

/**
 *
 * @author ls
 * @since 2022/1/22 15:15
 * @version V1.0
 */
public class HikariCpsMonitorTask extends AbstractHikariCpMonitorTask {

    @Setter
    @Autowired
    private Collection dataSources;

    @PostConstruct
    public void setup() {
        Objects.requireNonNull(dataSources);
        log.debug("{}", dataSources);
    }

    @Override
    protected void execute() {
        log.debug("HikariCpsMonitorTask.execute");
        if (CollectionUtils.isEmpty(dataSources)) {
            log.info("HikariCpsMonitorTask dataSources is empty. {}", dataSources);
            return;
        }
        for (HikariDataSource ds : dataSources) {
            logInfo(ds);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy