Пример #1
0
 /**
  * Updates all the series from the current snapshot.
  *
  * @param current the current snapshot.
  * @since 1.607
  */
 protected void updateCounts(LoadStatisticsSnapshot current) {
   definedExecutors.update(current.getDefinedExecutors());
   onlineExecutors.update(current.getOnlineExecutors());
   connectingExecutors.update(current.getConnectingExecutors());
   busyExecutors.update(current.getBusyExecutors());
   idleExecutors.update(current.getIdleExecutors());
   availableExecutors.update(current.getAvailableExecutors());
   queueLength.update(current.getQueueLength());
 }
Пример #2
0
  /**
   * Computes the self-consistent snapshot with the specified queue items.
   *
   * @param queue the queue items.
   * @return a self-consistent snapshot of the load statistics.
   * @since 1.607
   */
  protected LoadStatisticsSnapshot computeSnapshot(Iterable<Queue.BuildableItem> queue) {
    final LoadStatisticsSnapshot.Builder builder = LoadStatisticsSnapshot.builder();
    final Iterable<Node> nodes = getNodes();
    if (nodes != null) {
      for (Node node : nodes) {
        builder.with(node);
      }
    }
    int q = 0;
    if (queue != null) {
      for (Queue.BuildableItem item : queue) {

        for (SubTask st : item.task.getSubTasks()) {
          if (matches(item, st)) q++;
        }
      }
    }
    return builder.withQueueLength(q).build();
  }