public virtual void CheckGroups(int size) { lock (this) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int groupsMax = GetGroupsMax(); if (size > groupsMax) { firstViolation = new LimitExceededException("Too many counter groups: " + size + " max=" + groupsMax); } } }
public virtual void CheckCounters(int size) { lock (this) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int countersMax = GetCountersMax(); if (size > countersMax) { firstViolation = new LimitExceededException("Too many counters: " + size + " max=" + countersMax); throw firstViolation; } } }