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());
}
}
}
Aggregations