private void closeCopyConnection()

in flink-vvp-connector-adbpg/src/main/java/org/apache/flink/connector/jdbc/table/sink/AdbpgOutputFormat.java [1097:1122]


    private void closeCopyConnection() {
        try {
            LOG.info("Close copy connection ");
            if (rawConn != null) {
                if (!rawConn.isClosed()) {
                    rawConn.close();
                }
                if (dataSource != null) {
                    dataSource.discardConnection(rawConn);
                }
            }
            // We should close and discard druid connection firstly, then close base connection.
            // Otherwise, druid will try to recycle the closed base connection, and print unusable log.
            if (baseConn != null) {
                if (!baseConn.isClosed()) {
                    baseConn.close();
                }
            }
        } catch (SQLException e) {
            LOG.error("error during closeCopyConnection");
            throw new RuntimeException(e);
        } finally {
            rawConn = null;
            baseConn = null;
        }
    }