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

com.alicloud.openservices.tablestore.timeserieswriter.TimeseriesWriterResult Maven / Gradle / Ivy

Go to download

Aliyun Open Services SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 (C)阿里云计算有限公司 http://www.aliyun.com

The newest version!
package com.alicloud.openservices.tablestore.timeserieswriter;

import com.alicloud.openservices.tablestore.model.timeseries.TimeseriesTableRow;

import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReferenceArray;

public class TimeseriesWriterResult {
    private boolean isAllFinished = true;
    private final int totalCount;
    private final AtomicReferenceArray timeseriesRowChangeStatusList;

    public TimeseriesWriterResult(int totalCount, AtomicReferenceArray timeseriesRowChangeStatusList) {
        this.totalCount = totalCount;
        this.timeseriesRowChangeStatusList = timeseriesRowChangeStatusList;
    }

    public List getSucceedRows() {
        List succeed = new LinkedList();
        for (int i = 0; i < timeseriesRowChangeStatusList.length(); i++) {
            TimeseriesWriterResult.TimeseriesRowChangeStatus timeseriesRowChangeStatus = timeseriesRowChangeStatusList.get(i);
            if (timeseriesRowChangeStatus.isSucceed()) {
                succeed.add(timeseriesRowChangeStatus);
            }
        }
        return succeed;
    }

    public List getFailedRows() {
        List failed = new LinkedList();
        for (int i = 0; i < timeseriesRowChangeStatusList.length(); i++) {
            TimeseriesWriterResult.TimeseriesRowChangeStatus timeseriesRowChangeStatus = timeseriesRowChangeStatusList.get(i);
            if (!timeseriesRowChangeStatus.isSucceed()) {
                failed.add(timeseriesRowChangeStatus);
            }
        }
        return failed;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public boolean isAllFinished() {
        return isAllFinished;
    }

    public boolean isAllSucceed() {
        List failed = new LinkedList();
        for (int i = 0; i < timeseriesRowChangeStatusList.length(); i++) {
            TimeseriesWriterResult.TimeseriesRowChangeStatus timeseriesRowChangeStatus = timeseriesRowChangeStatusList.get(i);
            if (!timeseriesRowChangeStatus.isSucceed()) {
                failed.add(timeseriesRowChangeStatus);
            }
        }
        return failed.size() == 0;
    }

    public static class TimeseriesRowChangeStatus {
        private boolean succeed;
        private Exception exception;
        private TimeseriesTableRow timeseriesTableRow;

        public TimeseriesRowChangeStatus(boolean succeed, TimeseriesTableRow timeseriesTableRow, Exception exception) {
            this.succeed = succeed;
            this.timeseriesTableRow = timeseriesTableRow;
            this.exception = exception;
        }

        public boolean isSucceed() {
            return succeed;
        }

        public Exception getException() {
            return exception;
        }

        public TimeseriesTableRow getTimeseriesTableRow() {
            return timeseriesTableRow;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy