class ContainerSet {

  public ContainerReportsProto getContainerReport() throws IOException {
    LOG.debug("Starting container report iteration.");

    // No need for locking since containerMap is a ConcurrentSkipListMap
    // And we can never get the exact state since close might happen
    // after we iterate a point.
    List<Container<?>> containers = new ArrayList<>(containerMap.values());

    ContainerReportsProto.Builder crBuilder =
        ContainerReportsProto.newBuilder();

    for (Container<?> container: containers) {
      crBuilder.addReports(container.getContainerReport());
    }

    return crBuilder.build();
  }

}