get batch Metrics Map - Java javax.batch.runtime

Java examples for javax.batch.runtime:Metric

Description

get batch Metrics Map

Demo Code


import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchStatus;
import javax.batch.runtime.JobExecution;
import javax.batch.runtime.Metric;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;

public class Main{
    public static Map<Metric.MetricType, Long> getMetricsMap(
            Metric[] metrics) {//from   w w w  .  j  a  v  a 2s. co  m
        Map<Metric.MetricType, Long> metricsMap = new HashMap<>();
        for (Metric metric : metrics) {
            metricsMap.put(metric.getType(), metric.getValue());
        }
        return metricsMap;
    }
}

Related Tutorials