public virtual T AddCounter(string counterName, string displayName, long value) { lock (this) { string saveName = Limits.FilterCounterName(counterName); T counter = FindCounterImpl(saveName, false); if (counter == null) { return(AddCounterImpl(saveName, displayName, value)); } counter.SetValue(value); return(counter); } }
public virtual T FindCounter(string counterName, string displayName) { lock (this) { // Take lock to avoid two threads not finding a counter and trying to add // the same counter. string saveName = Limits.FilterCounterName(counterName); T counter = FindCounterImpl(saveName, false); if (counter == null) { return(AddCounterImpl(saveName, displayName, 0)); } return(counter); } }
public virtual T FindCounter(string counterName, bool create) { return(FindCounterImpl(Limits.FilterCounterName(counterName), create)); }