/**
   * Add the given entity to the controller for read processing.
   *
   * @param entity to process reads for
   */
  public void addReadEntity(RateControlledEntity entity) {
    try {
      entities_mon.enter();
      if (entity.getPriority() == RateControlledEntity.PRIORITY_HIGH) {
        // copy-on-write
        ArrayList<RateControlledEntity> high_new =
            new ArrayList<RateControlledEntity>(high_priority_entities.size() + 1);
        high_new.addAll(high_priority_entities);
        high_new.add(entity);
        high_priority_entities = high_new;
      } else {
        // copy-on-write
        ArrayList<RateControlledEntity> norm_new =
            new ArrayList<RateControlledEntity>(normal_priority_entities.size() + 1);
        norm_new.addAll(normal_priority_entities);
        norm_new.add(entity);
        normal_priority_entities = norm_new;
      }

      entity_count = normal_priority_entities.size() + high_priority_entities.size();
    } finally {
      entities_mon.exit();
    }

    read_waiter.eventOccurred();
  }