/**
   * Get the Schedulable representing the pool with a given name If it doesn't exist - create it and
   * add it to the list
   *
   * @param poolInfo Group and pool names
   * @return the PoolSchedulable for a pool with a given name
   */
  private PoolSchedulable getPoolSchedulable(PoolInfo poolInfo) {
    PoolGroupSchedulable poolGroup = nameToPoolGroup.get(poolInfo.getPoolGroupName());
    if (poolGroup == null) {
      poolGroup = new PoolGroupSchedulable(poolInfo.getPoolGroupName(), type, configManager);
      PoolGroupSchedulable prevPoolGroup =
          nameToPoolGroup.putIfAbsent(poolInfo.getPoolGroupName(), poolGroup);
      if (prevPoolGroup != null) {
        poolGroup = prevPoolGroup;
      }
    }

    return poolGroup.getPool(poolInfo);
  }
  /** Take snapshots for all pools groups and sessions. */
  public void snapshot() {
    snapshotPoolGroups = new ArrayList<PoolGroupSchedulable>(nameToPoolGroup.values());
    for (PoolGroupSchedulable poolGroup : snapshotPoolGroups) {
      poolGroup.snapshot();
    }
    scheduleQueue = null;
    preemptQueue = null;

    // Load the configured pools for stats and cm.jsp
    // (needs to modify nameToPoolGroup)
    Collection<PoolInfo> configuredPoolInfos = configManager.getConfiguredPoolInfos();
    if (configuredPoolInfos != null) {
      for (PoolInfo poolInfo : configuredPoolInfos) {
        getPoolSchedulable(poolInfo);
      }
    }
  }