use of org.apache.nifi.controller.StandardCounter in project nifi by apache.
the class StandardCounterRepository method getModifiableCounter.
private Counter getModifiableCounter(final String counterContext, final String name) {
ConcurrentMap<String, Counter> counters = processorCounters.get(counterContext);
if (counters == null) {
counters = new ConcurrentHashMap<>();
final ConcurrentMap<String, Counter> oldProcessorCounters = processorCounters.putIfAbsent(counterContext, counters);
if (oldProcessorCounters != null) {
counters = oldProcessorCounters;
}
}
Counter counter = counters.get(name);
if (counter == null) {
counter = new StandardCounter(getIdentifier(counterContext, name), counterContext, name);
final Counter oldCounter = counters.putIfAbsent(name, counter);
if (oldCounter != null) {
counter = oldCounter;
}
}
return counter;
}
use of org.apache.nifi.controller.StandardCounter in project nifi by apache.
the class CounterAdapter method unmarshal.
@Override
public Counter unmarshal(final AdaptedCounter aCounter) throws Exception {
if (aCounter == null) {
return null;
}
final Counter counter = new StandardCounter(aCounter.getIdentifier(), aCounter.getContext(), aCounter.getName());
counter.adjust(aCounter.getValue());
return counter;
}
Aggregations