private static void throwIfAnyReachedMaxAttempts()

in flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaGroupOpsImpl.java [125:142]


    private static void throwIfAnyReachedMaxAttempts(
            GroupXaOperationResult<CheckpointAndXid> result, int maxAttempts) {
        List<CheckpointAndXid> reached = null;
        for (CheckpointAndXid x : result.getForRetry()) {
            if (x.attempts >= maxAttempts) {
                if (reached == null) {
                    reached = new ArrayList<>();
                }
                reached.add(x);
            }
        }
        if (reached != null) {
            throw new RuntimeException(
                    String.format(
                            "reached max number of commit attempts (%d) for transactions: %s",
                            maxAttempts, reached));
        }
    }