ru.fix.aggregating.profiler.engine.AdderDrainer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aggregating-profiler Show documentation
Show all versions of aggregating-profiler Show documentation
https://github.com/ru-fix/aggregating-profiler
package ru.fix.aggregating.profiler.engine;
import java.util.concurrent.atomic.DoubleAdder;
import java.util.concurrent.atomic.LongAdder;
public class AdderDrainer {
public static long drain(LongAdder adder) {
long sum = adder.sum();
adder.add(-sum);
return sum;
}
public static double drain(DoubleAdder adder) {
double sum = adder.sum();
adder.add(-sum);
return sum;
}
}