code: public void registerCounter(ByteString counterName, CounterEventGenerator generator,
           TopologyChangeListener topologyChangeListener) {
        if (counters.putIfAbsent(counterName, new Holder(generator, topologyChangeListener)) != null) {
           throw new IllegalStateException();
        }
     }
docs: It registers a new counter created locally.
  
  @param counterName            The counter's name.
  @param generator              The counter's {@link CounterEvent} generator.
  @param topologyChangeListener The counter's listener to topology change. It can be {@code null}.
  @throws IllegalStateException If the counter with that name is already registered.