Пример #1
0
  /**
   * 'Broadcast' (or receive) the list of all agents in a container with a registered sensor. The
   * information will be set to the local {@link #loadInfo}.
   *
   * @param slices the slices
   * @throws ServiceException the service exception
   */
  private void broadcastGetAIDListSensorAgents(Service.Slice[] slices) throws ServiceException {

    loadInfo.sensorAgents = new Vector<>();
    logger.debug("Try to get Sensor-AID's from all Containers !");

    for (int i = 0; i < slices.length; i++) {
      String sliceName = null;
      try {
        LoadServiceSlice slice = (LoadServiceSlice) slices[i];
        sliceName = slice.getNode().getName();
        logger.debug("Try to get Sensor-AID''s from " + sliceName);

        AID[] aidList = slice.getAIDListSensorAgents();
        loadInfo.sensorAgents.addAll(new Vector<>(Arrays.asList(aidList)));
      } catch (ServiceException | IMTPException t) {
        // NOTE that slices are always retrieved from the main and not from the cache --> No need to
        // retry in case of failure
        logger.warn("Error while trying to get Sensor-AID's from " + sliceName, t);
      }
    }
  }