Search in sources :

Example 1 with BasicCounters

use of org.apache.apex.malhar.lib.counters.BasicCounters in project apex-malhar by apache.

the class BlockWriter method addCounters.

/**
 * Transfers the counters in partitioning.
 *
 * @param target
 *          target counter
 * @param source
 *          removed counter
 */
protected void addCounters(BasicCounters<MutableLong> target, BasicCounters<MutableLong> source) {
    for (Enum<BlockWriter.Counters> key : BlockWriter.Counters.values()) {
        MutableLong tcounter = target.getCounter(key);
        if (tcounter == null) {
            tcounter = new MutableLong();
            target.setCounter(key, tcounter);
        }
        MutableLong scounter = source.getCounter(key);
        if (scounter != null) {
            tcounter.add(scounter.longValue());
        }
    }
}
Also used : MutableLong(org.apache.commons.lang.mutable.MutableLong) BasicCounters(org.apache.apex.malhar.lib.counters.BasicCounters)

Aggregations

BasicCounters (org.apache.apex.malhar.lib.counters.BasicCounters)1 MutableLong (org.apache.commons.lang.mutable.MutableLong)1