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

com.librato.metrics.BatchResult Maven / Gradle / Ivy

package com.librato.metrics;

import java.util.ArrayList;
import java.util.List;

/**
 * Composes the results of processing a batch.  A batch may be broken up into multiple
 * postings.
 */
public class BatchResult {
    private final List posts = new ArrayList();

    public List getPosts() {
        return posts;
    }

    void addPostResult(PostResult result) {
        posts.add(result);
    }

    public List getFailedPosts() {
        List failed = new ArrayList();
        for (PostResult post : posts) {
            if (!post.success()) {
                failed.add(post);
            }
        }
        return failed;
    }

    public boolean success() {
        for (PostResult post : posts) {
            if (!post.success()) {
                return false;
            }
        }
        return true;
    }

    @Override
    public String toString() {
        return "BatchResult{" +
                "posts=" + posts +
                '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy