コード例 #1
0
  public void runAlgorithm(final String trackID) throws IOException {
    LOGGER.debug("Aggregating Track: " + trackID);

    if (pointService.trackAlreadyAggregated(trackID)) {
      LOGGER.info("Track already aggregated. skipping. " + trackID);
      return;
    }

    HttpGet get = new HttpGet(GlobalProperties.getRequestTrackURL() + trackID);

    HttpClient client;
    try {
      client = createClient();
    } catch (KeyManagementException
        | UnrecoverableKeyException
        | NoSuchAlgorithmException
        | KeyStoreException e) {
      throw new IllegalStateException(e);
    }

    HttpResponse resp = client.execute(get);
    if (resp != null
        && resp.getEntity() != null
        && resp.getStatusLine() != null
        && resp.getStatusLine().getStatusCode() < HttpStatus.SC_MULTIPLE_CHOICES) {

      PointViaJsonMapIterator it =
          new PointViaJsonMapIterator(Utils.parseJsonStream(resp.getEntity().getContent()));

      runAlgorithm(it, trackID);
    }
  }