class Holder {
        public static final DatabaseAccessor ACCESSOR = new DatabaseAccessor();
    }

    private String jdbcDriver = ""; // 数据库驱动
    private String dbUrl = ""; // 数据库 URL
    private String dbUsername = ""; // 数据库用户名
    private String dbPassword = ""; // 数据库用户密码
    private int initialConnections = 10; // 连接池的初始大小
    private int autoIncreaseStep = 5;// 连接池自增步进
    private int maxConnections = 50; // 连接池最大的大小
    private List<PooledConnection> connections = null; // 存放连接池中数据库连接的向量 , 初始时为 null


    public DatabaseAccessor() {
        this(
                "com.mysql.jdbc.Driver",
                "jdbc:mysql://localhost:3306/XueQiuSpider",
                "root",
                "123456"
        );
    }



    public DatabaseAccessor(String jdbcDriver, String dbUrl, String dbUsername,
                          String dbPassword) {

        this.jdbcDriver = jdbcDriver;
        this.dbUrl = dbUrl;
        this.dbUsername = dbUsername;
        this.dbPassword = dbPassword;

        try {
            createPool();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }



    public synchronized void createPool() throws Exception {

        if (connections != null) return;

        Class.forName(this.jdbcDriver);
        connections = new CopyOnWriteArrayList<>();
        createConnections(this.initialConnections);
        System.out.println(" 数据库连接池创建成功！ ");

    }



    public synchronized Connection getConnection() {

        if (connections == null) return null;
        Connection conn;
        // if no available connection retry
        while (true) {
            wait(250);
            try {
                conn = getFreeConnection();
                break;
            } catch (Exception e) {
                System.out.println("线程池忙，等待空闲线程");
            }
        }
        return conn;// 返回获得的可用的连接

    }



    public void returnConnection(Connection conn) {

        if (connections == null) {
            System.out.println(" 连接池不存在，无法返回此连接到连接池中 !");
            return;
        }

        PooledConnection connection = this.connections.stream()
                .filter(x -> x.getConnection() == conn)
                .findAny()
                .orElse(emptyPooledConn);
        connection.setBusy(false);

    }



    public synchronized void refreshConnections() throws SQLException {<FILL_FUNCTION_BODY>


        if (connections == null) {
            System.out.println(" 连接池不存在，无法刷新 !");
            return;
        }

        for (PooledConnection connection : connections) {
            if (connection.isBusy()) wait(5000);
            // 关闭此连接，用一个新的连接代替它。
            closeConnection(connection.getConnection());
            connection.setConnection(newConnection());
            connection.setBusy(false);
        }

    
<no_super_class>