Пример #1
0
  @Override
  public void setLimit(@Nonnull String counterName, long counterValue) {
    if (counterValue > 0) limits.put(counterName, counterValue);
    else limits.remove(counterName);

    StringBuilder s = new StringBuilder();
    for (Entry<String, Long> e : limits.entrySet())
      s.append(e.getKey()).append('=').append(e.getValue().toString()).append(';');
    setAttribute(LIMITS_ATTRIBUTE, s.toString());

    if (TIMER_COUNTER.equals(counterName)) fixTimeLimit();
    fireBaseEvent(LIMITS);
  }
Пример #2
0
  @Override
  public Counter getCounter(String counterName) {
    if (TIMER_COUNTER.equals(counterName)) return timerCounter;

    return counterSupport.getCounter(counterName);
  }