Пример #1
0
  private void solrDelete(K key) throws Exception {

    JsonObject doc = new JsonObject();
    doc.putObject("delete", (new JsonObject()).putString(SolrTools.F_ID, buildSolrId(key)));

    JsonObject jsonResponse = null;
    Exception ex = null;
    for (int i = 0; i < _urlUpdates.size(); i++) {
      try {
        jsonResponse = SolrTools.delDoc(getSolrUpdateUrl(), _connectTimeout, _readTimeout, doc);
        if (SolrTools.getStatus(jsonResponse) == 0) {
          ex = null;
          break;
        }
      } catch (Exception e) {
        ex = e;
        try {
          Thread.sleep(100);
        } catch (InterruptedException e1) {
        }
      }
    }
    if (ex != null) {
      throw ex;
    }

    if (SolrTools.getStatus(jsonResponse) != 0) {
      throw new RuntimeException(jsonResponse.encodePrettily());
    }
  }