/** Remove the counters for the given job group. */
 public void removeByGroupCounters(TaskTimer timer, QueueJobGroup group) {
   timer.acquire();
   synchronized (pCountersByGroup) {
     timer.resume();
     pCountersByGroup.remove(group.getGroupID());
   }
 }
  /** Create a new set of shared job state counters for all jobs in the given group. */
  public void initCounters(TaskTimer timer, QueueJobGroup group) {
    long groupID = group.getGroupID();

    if (LogMgr.getInstance().isLoggable(LogMgr.Kind.Ops, LogMgr.Level.Finest))
      LogMgr.getInstance()
          .log(LogMgr.Kind.Ops, LogMgr.Level.Finest, "Init Job Counts for Group (" + groupID + ")");

    SortedSet<Long> jobIDs = group.getJobIDs();
    Counters counters = new Counters(jobIDs.size());

    timer.acquire();
    synchronized (pCountersByGroup) {
      timer.resume();

      if (pCountersByGroup.put(groupID, counters) != null)
        LogMgr.getInstance()
            .logAndFlush(
                LogMgr.Kind.Ops,
                LogMgr.Level.Warning,
                "Somehow the job group ("
                    + groupID
                    + ") was already in the state "
                    + "counts table!");
    }

    timer.acquire();
    synchronized (pCountersByJob) {
      timer.resume();

      for (Long jobID : jobIDs) {
        if (pCountersByJob.put(jobID, counters) != null)
          LogMgr.getInstance()
              .logAndFlush(
                  LogMgr.Kind.Ops,
                  LogMgr.Level.Warning,
                  "Somehow the job (" + jobID + ") was already in the state counts table!");
      }
    }
  }