コード例 #1
0
ファイル: RemotePipeline.java プロジェクト: nuth/Hydra
  public boolean markPending(LocalDocument d) throws IOException {
    HttpResponse response = core.post(pendingUrl, d.contentFieldsToJson(null));
    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
      EntityUtils.consume(response.getEntity());

      return true;
    }

    logUnexpected(response);

    return false;
  }
コード例 #2
0
ファイル: RemotePipeline.java プロジェクト: nuth/Hydra
  /**
   * Releases the most recently read document back to the pipeline
   *
   * @return true if there was a document to release
   * @throws HttpException
   * @throws IOException
   */
  public boolean releaseLastDocument() throws IOException {
    if (currentDocument == null) {
      InternalLogger.debug("There is no document to release...");
      return false;
    }
    HttpResponse response = core.post(releaseUrl, currentDocument.contentFieldsToJson(null));
    currentDocument = null;
    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
      EntityUtils.consume(response.getEntity());
      return true;
    }

    logUnexpected(response);

    return false;
  }