コード例 #1
0
 /**
  * Add data to ES given a query execution service
  *
  * @param qExec query execution service
  */
 private void harvest(QueryExecution qExec) {
   boolean retry;
   do {
     retry = false;
     try {
       Model model = getModel(qExec);
       addModelToES(model, client.prepareBulk(), true);
     } catch (QueryExceptionHTTP e) {
       if (e.getResponseCode() >= 500) {
         retry = true;
         logger.error("Encountered an internal server error " + "while harvesting. Retrying!");
       } else {
         throw e;
       }
     }
   } while (retry);
 }
コード例 #2
0
 protected Model executeConstructQuery(String query) {
   logger.trace("Sending query\n{} ...", query);
   QueryExecution qe = qef.createQueryExecution(query);
   try {
     Model model = qe.execConstruct();
     timeout = false;
     if (model.size() == 0) {
       fullDataLoaded = true;
     }
     logger.debug("Got " + model.size() + " triples.");
     return model;
   } catch (QueryExceptionHTTP e) {
     if (e.getCause() instanceof SocketTimeoutException) {
       logger.warn("Got timeout");
     } else {
       logger.error("Exception executing query", e);
     }
     return ModelFactory.createDefaultModel();
   }
 }
コード例 #3
0
  protected ResultSet executeSelectQuery(String query) {
    logger.trace("Sending query\n{} ...", query);

    QueryExecution qe = qef.createQueryExecution(query);
    try {
      ResultSet rs = qe.execSelect();
      timeout = false;
      return rs;
    } catch (QueryExceptionHTTP e) {
      if (e.getCause() instanceof SocketTimeoutException) {
        if (timeout) {
          logger.warn("Got timeout");
          throw e;
        } else {
          logger.trace("Got local timeout");
        }

      } else {
        logger.error("Exception executing query", e);
      }
      return new ResultSetMem();
    }
  }
コード例 #4
0
ファイル: EldaException.java プロジェクト: rodzyn0688/iserve
 public static void ARQ_Exception(Source source, QueryExceptionHTTP ie) {
   throw new EldaException(
       "Problem running query for " + source + ": " + ie.getMessage(), "", SERVER_ERROR, ie);
 }