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

org.eobjects.analyzer.cluster.AnalysisResultReductionException Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
/**
 * AnalyzerBeans
 * Copyright (C) 2014 Neopost - Customer Information Management
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.eobjects.analyzer.cluster;

import java.util.Collection;

import org.eobjects.analyzer.job.AnalyzerJob;
import org.eobjects.analyzer.result.AnalyzerResult;
import org.eobjects.analyzer.result.AnalyzerResultReducer;

/**
 * Exception raised when performing the reduction by a
 * {@link AnalyzerResultReducer} failed. This condition indicates that results
 * where succesfully produced by all slave nodes in a cluster, but the results
 * could not be combined/reduced without errors.
 */
public class AnalysisResultReductionException extends IllegalStateException {

    private final AnalyzerJob _analyzerJob;
    private final Collection _slaveResults;

    private static final long serialVersionUID = 1L;

    public AnalysisResultReductionException(AnalyzerJob analyzerJob, Collection slaveResults,
            Exception cause) {
        super(cause);
        _analyzerJob = analyzerJob;
        _slaveResults = slaveResults;
    }
    
    @Override
    public String getMessage() {
        return "Failed to reduce results for " + _analyzerJob + ": " + getCause().getMessage();
    }

    /**
     * Gets the {@link AnalyzerJob} for which the results pertained to.
     * 
     * @return
     */
    public AnalyzerJob getAnalyzerJob() {
        return _analyzerJob;
    }

    /**
     * Gets the individual results from the slaves in the cluster
     * 
     * @return
     */
    public Collection getSlaveResults() {
        return _slaveResults;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy