APISonar


org.apache.solr.common.SolrException.log

> org > apache > solr > common > SolrException > log
org APIs apache APIs solr APIs common APIs SolrException APIs log APIs

Example 1
public final void close() throws IOException {
    @SuppressWarnings("resource")
    UpdateRequestProcessor p = this;
    while (p != null) {
      try {
        p.doClose();
      } catch(Exception e) {
        SolrException.log(log, "Exception closing processor", e);
      }
      p = p.next;
    }
  }
Example 2
public Properties getSolrProperties(String path) {
    try {
      return readProperties(((NodeList) config.evaluate(
          path, XPathConstants.NODESET)).item(0));
    } catch (Exception e) {
      SolrException.log(log, null, e);
    }
    return null;

  }
Example 3
protected void writeException(Exception e, Writer out, boolean log) throws IOException{
    out.write("{\"responseHeader\": {\"status\": 400}, \"response\":{\"numFound\":0, \"docs\":[");
    out.write("{\"EXCEPTION\":\"");
    writeStr(e.getMessage(), out);
    out.write("\"}");
    out.write("]}}");
    out.flush();
    if(log) {
      SolrException.log(logger, e);
    }
  }
Example 4
private void close(CacheValue val) {
    try {
      log.info("Closing directory: " + val.path);
      val.directory.close();
    } catch (Throwable t) {
      SolrException.log(log, "Error closing directory", t);
    }
  }
Example 5
public void reconnect(final String serverAddress, final int zkClientTimeout,
      final Watcher watcher, final ZkUpdate updater) throws IOException {
    log.info("Connection expired - starting a new one...");
    
    try {
      updater
          .update(new SolrZooKeeper(serverAddress, zkClientTimeout, watcher));
      log.info("Reconnected to ZooKeeper");
    } catch (Exception e) {
      SolrException.log(log, "Reconnect to ZooKeeper failed", e);
      log.info("Reconnect to ZooKeeper failed");
    }
    
  }
Example 6
protected void writeException(Exception e, PushWriter w, boolean logException) throws IOException {
    w.writeMap(mw -> {
      mw.put("responseHeader", singletonMap("status", 400))
          .put("response", makeMap(
              "numFound", 0,
              "docs", singletonList(singletonMap("EXCEPTION", e.getMessage()))));
    });
    if (logException) {
      SolrException.log(log, e);
    }
  }
Example 7
public Properties getCoreProperties(String coreName) {
    synchronized (coreNodes) {
      for (int idx = 0; idx < coreNodes.getLength(); idx++) {
        Node node = coreNodes.item(idx);
        if (coreName.equals(DOMUtil.getAttr(node, CoreDescriptor.CORE_NAME, null))) {
          try {
            return readProperties(node);
          } catch (XPathExpressionException e) {
            SolrException.log(log, e);
          }
        }
      }
    }
    return new Properties();
  }
Example 8
private int msgStrToInt(ZkNodeProps message, String key, Integer def)
      throws Exception {
    String str = message.getStr(key);
    try {
      return str == null ? def : Integer.parseInt(str);
    } catch (Exception ex) {
      SolrException.log(log, "Could not parse " + key, ex);
      throw ex;
    }
  }
Example 9
private Map<String,Object> getNextFromCache(String query,
      Iterator<Map<String,Object>> rowIterator) {
    try {
      if (rowIterator == null) return null;
      if (rowIterator.hasNext()) return rowIterator.next();
      return null;
    } catch (Exception e) {
      SolrException.log(log, "getNextFromCache() failed for query '" + query
          + "'", e);
      wrapAndThrow(DataImportHandlerException.WARN, e);
      return null;
    }
  }
Example 10
public void cancelCoreRecoveries() {

    List<SolrCore> cores = solrCores.getCores();

    // we must cancel without holding the cores sync
    // make sure we wait for any recoveries to stop
    for (SolrCore core : cores) {
      try {
        core.getSolrCoreState().cancelRecovery();
      } catch (Exception e) {
        SolrException.log(log, "Error canceling recovery for core", e);
      }
    }
  }
Example 11
final void sendErr(int rc, String msg, HttpServletRequest request, HttpServletResponse response) {
    try {
      // hmmm, what if this was already set to text/xml?
      try{
        response.setContentType(QueryResponseWriter.CONTENT_TYPE_TEXT_UTF8);
        // response.setCharacterEncoding("UTF-8");
      } catch (Exception e) {}
      try{response.setStatus(rc);} catch (Exception e) {}
      PrintWriter writer = response.getWriter();
      writer.write(msg);
    } catch (IOException e) {
      SolrException.log(log,e);
    }
  }
Example 12
long getIndexSize() {
    Directory dir;
    long size = 0;
    try {
      dir = core.getDirectoryFactory().get(core.getIndexDir(), DirContext.DEFAULT, core.getSolrConfig().indexConfig.lockType);
      try {
        size = DirectoryFactory.sizeOfDirectory(dir);
      } finally {
        core.getDirectoryFactory().release(dir);
      }
    } catch (IOException e) {
      SolrException.log(LOG, "IO error while trying to get the size of the Directory", e);
    }
    return size;
  }
Example 13
private void doRequest(final Req req) {
    try {
      SolrServer solrServer = servers.getSolrServer(req);
      solrServer.request(req.uReq);
    } catch (Exception e) {
      SolrException.log(log, e);
      Error error = new Error();
      error.e = e;
      error.req = req;
      if (e instanceof SolrException) {
        error.statusCode = ((SolrException) e).code();
      }
      errors.add(error);
    }
  }
Example 14
final private void recoveryFailed(final SolrCore core,
      final ZkController zkController, final String baseUrl,
      final String shardZkNodeName, final CoreDescriptor cd) throws Exception {
    SolrException.log(log, "Recovery failed - I give up.");
    try {
      zkController.publish(cd, Replica.State.RECOVERY_FAILED);
    } finally {
      close();
      recoveryListener.failed();
    }
  }
Example 15
public SolrCache newInstance() {
    try {
      SolrCache cache = clazz.getConstructor().newInstance();
      persistence[0] = cache.init(args, persistence[0], regenerator);
      return cache;
    } catch (Exception e) {
      SolrException.log(log,"Error instantiating cache",e);
      // we can carry on without a cache... but should we?
      // in some cases (like an OOM) we probably should try to continue.
      return null;
    }
  }