public synchronized void checkCounters(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int countersMax = getCountersMax(); if (size > countersMax) { firstViolation = new LimitExceededException("Too many counters: "+ size + " max="+ countersMax); throw firstViolation; } }
public synchronized void checkCounters(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int countersMax = getCountersMax(); if (size > countersMax) { firstViolation = new LimitExceededException("Too many counters: "+ size + " max="+ countersMax); throw firstViolation; } }
public synchronized void checkCounters(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int countersMax = getCountersMax(); if (size > countersMax) { firstViolation = new LimitExceededException("Too many counters: "+ size + " max="+ countersMax); throw firstViolation; } }
public synchronized void checkCounters(int size) { if (firstViolation != null) { throw new LimitExceededException(firstViolation); } int countersMax = getCountersMax(); if (size > countersMax) { firstViolation = new LimitExceededException("Too many counters: "+ size + " max="+ countersMax); throw firstViolation; } }
private void testMaxCounters(final Counters counters) { LOG.info("counters max="+ Limits.getCountersMax()); for (int i = 0; i < Limits.getCountersMax(); ++i) { counters.findCounter("test", "test"+ i); } setExpected(counters); shouldThrow(LimitExceededException.class, new Runnable() { public void run() { counters.findCounter("test", "bad"); } }); checkExpected(counters); }