當前位置: 首頁>>代碼示例>>Java>>正文


Java SolrException.log方法代碼示例

本文整理匯總了Java中org.apache.solr.common.SolrException.log方法的典型用法代碼示例。如果您正苦於以下問題:Java SolrException.log方法的具體用法?Java SolrException.log怎麽用?Java SolrException.log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.solr.common.SolrException的用法示例。


在下文中一共展示了SolrException.log方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doFullImport

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
public void doFullImport(DIHWriter writer, RequestInfo requestParams) {
  LOG.info("Starting Full Import");
  setStatus(Status.RUNNING_FULL_DUMP);
  try {
    DIHProperties dihPropWriter = createPropertyWriter();
    setIndexStartTime(dihPropWriter.getCurrentTimestamp());
    docBuilder = new DocBuilder(this, writer, dihPropWriter, requestParams);
    checkWritablePersistFile(writer, dihPropWriter);
    docBuilder.execute();
    if (!requestParams.isDebug())
      cumulativeStatistics.add(docBuilder.importStatistics);
  } catch (Exception e) {
    SolrException.log(LOG, "Full Import failed", e);
    docBuilder.handleError("Full Import failed", e);
  } finally {
    setStatus(Status.IDLE);
    DocBuilder.INSTANCE.set(null);
  }

}
 
開發者ID:europeana,項目名稱:search,代碼行數:21,代碼來源:DataImporter.java

示例2: clearRequestInfo

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
public static void clearRequestInfo() {
  try {
    SolrRequestInfo info = threadLocal.get();
    if (info != null && info.closeHooks != null) {
      for (Closeable hook : info.closeHooks) {
        try {
          hook.close();
        } catch (Exception e) {
          SolrException.log(SolrCore.log, "Exception during close hook", e);
        }
      }
    }
  } finally {
    threadLocal.remove();
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:17,代碼來源:SolrRequestInfo.java

示例3: newHolder

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
private RefCounted<SolrIndexSearcher> newHolder(SolrIndexSearcher newSearcher, final List<RefCounted<SolrIndexSearcher>> searcherList) {
  RefCounted<SolrIndexSearcher> holder = new RefCounted<SolrIndexSearcher>(newSearcher) {
    @Override
    public void close() {
      try {
        synchronized(searcherLock) {
          // it's possible for someone to get a reference via the _searchers queue
          // and increment the refcount while RefCounted.close() is being called.
          // we check the refcount again to see if this has happened and abort the close.
          // This relies on the RefCounted class allowing close() to be called every
          // time the counter hits zero.
          if (refcount.get() > 0) return;
          searcherList.remove(this);
        }
        resource.close();
      } catch (Exception e) {
        // do not allow decref() operations to fail since they are typically called in finally blocks
        // and throwing another exception would be very unexpected.
        SolrException.log(log, "Error closing searcher:" + this, e);
      }
    }
  };
  holder.incref();  // set ref count to 1 to account for this._searcher
  return holder;
}
 
開發者ID:europeana,項目名稱:search,代碼行數:26,代碼來源:SolrCore.java

示例4: deleteAll

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
/** currently for testing only */
public void deleteAll() {
  synchronized (this) {

    try {
      RefCounted<SolrIndexSearcher> holder = uhandler.core.openNewSearcher(true, true);
      holder.decref();
    } catch (Exception e) {
      SolrException.log(log, "Error opening realtime searcher for deleteByQuery", e);
    }

    if (map != null) map.clear();
    if (prevMap != null) prevMap.clear();
    if (prevMap2 != null) prevMap2.clear();

    oldDeletes.clear();
    deleteByQueries.clear();
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:20,代碼來源:UpdateLog.java

示例5: close

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
private void close(CacheValue val) {
  try {
    log.info("Closing directory: " + val.path);
    val.directory.close();
  } catch (Exception e) {
    SolrException.log(log, "Error closing directory", e);
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:9,代碼來源:CachingDirectoryFactory.java

示例6: connected

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
public synchronized void connected() {
  for (ConnectedListener listener : connectedListeners) {
    try {
      listener.connected();
    } catch (Exception e) {
      SolrException.log(log, "", e);
    }
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:10,代碼來源:ZkClientConnectionStrategy.java

示例7: closeCallbackExecutor

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
private void closeCallbackExecutor() {
  try {
    ExecutorUtil.shutdownAndAwaitTermination(zkCallbackExecutor);
  } catch (Exception e) {
    SolrException.log(log, e);
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:8,代碼來源:SolrZkClient.java

示例8: cancelCoreRecoveries

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
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);
      }
    }
  }
 
開發者ID:europeana,項目名稱:search,代碼行數:15,代碼來源:CoreContainer.java

示例9: replay

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
private Future<RecoveryInfo> replay(SolrCore core)
    throws InterruptedException, ExecutionException {
  Future<RecoveryInfo> future = core.getUpdateHandler().getUpdateLog().applyBufferedUpdates();
  if (future == null) {
    // no replay needed\
    log.info("No replay needed. core=" + coreName);
  } else {
    log.info("Replaying buffered documents. core=" + coreName);
    // wait for replay
    RecoveryInfo report = future.get();
    if (report.failed) {
      SolrException.log(log, "Replay failed");
      throw new SolrException(ErrorCode.SERVER_ERROR, "Replay failed");
    }
  }
  
  // solrcloud_debug
  if (log.isDebugEnabled()) {
    try {
      RefCounted<SolrIndexSearcher> searchHolder = core
          .getNewestSearcher(false);
      SolrIndexSearcher searcher = searchHolder.get();
      try {
        log.debug(core.getCoreDescriptor().getCoreContainer()
            .getZkController().getNodeName()
            + " replayed "
            + searcher.search(new MatchAllDocsQuery(), 1).totalHits);
      } finally {
        searchHolder.decref();
      }
    } catch (Exception e) {
      throw new SolrException(ErrorCode.SERVER_ERROR, null, e);
    }
  }
  
  return future;
}
 
開發者ID:europeana,項目名稱:search,代碼行數:38,代碼來源:RecoveryStrategy.java

示例10: nextRow

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
@Override
public Map<String, Object> nextRow() {
  if (rowcache != null) {
    return getFromRowCache();
  }
  while (true) {
    Map<String, Object> arow = null;
    try {
      arow = delegate.nextRow();
    } catch (Exception e) {
      if(ABORT.equals(onError)){
        wrapAndThrow(SEVERE, e);
      } else {
        //SKIP is not really possible. If this calls the nextRow() again the Entityprocessor would be in an inconisttent state           
        SolrException.log(log, "Exception in entity : "+ entityName, e);
        return null;
      }
    }
    if (arow == null) {
      return null;
    } else {
      arow = applyTransformer(arow);
      if (arow != null) {
        delegate.postTransform(arow);
        return arow;
      }
    }
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:30,代碼來源:EntityProcessorWrapper.java

示例11: getNextFromCache

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
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;
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:14,代碼來源:DIHCacheSupport.java

示例12: requestRecovery

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
private void requestRecovery(final ZkNodeProps leaderProps, final String baseUrl, final String coreName) throws SolrServerException, IOException {
  Thread thread = new Thread() {
    {
      setDaemon(true);
    }
    @Override
    public void run() {
      RequestRecovery recoverRequestCmd = new RequestRecovery();
      recoverRequestCmd.setAction(CoreAdminAction.REQUESTRECOVERY);
      recoverRequestCmd.setCoreName(coreName);
      
      HttpSolrServer server = new HttpSolrServer(baseUrl, client);
      try {
        server.setConnectionTimeout(30000);
        server.setSoTimeout(120000);
        server.request(recoverRequestCmd);
      } catch (Throwable t) {
        SolrException.log(log, ZkCoreNodeProps.getCoreUrl(leaderProps) + ": Could not tell a replica to recover", t);
        if (t instanceof Error) {
          throw (Error) t;
        }
      } finally {
        server.shutdown();
      }
    }
  };
  updateExecutor.execute(thread);
}
 
開發者ID:europeana,項目名稱:search,代碼行數:29,代碼來源:SyncStrategy.java

示例13: parseTerm

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
private static ParamInfo parseTerm(FunctionQParser fp) throws SyntaxError {
    ParamInfo paramInfo = new ParamInfo();

    paramInfo.field = fp.parseArg();
    String textVal = fp.parseArg();
    if(textVal == null || textVal.trim().length() == 0){
        return paramInfo;
    }

    if(fp.hasMoreArguments()){
        String similarity = fp.parseArg().toLowerCase().trim();
        if( !similarity.equals(SimilarityType.DOC_LEN) &&
            !similarity.equals(SimilarityType.PARAM_LEN) &&
            !similarity.equals(SimilarityType.DICE) &&
            !similarity.equals(SimilarityType.JACCARD)){

            log.error(String.format("Invalid similarity class: %s. Defaulting to %s", similarity, SimilarityType.DOC_LEN));
            similarity = SimilarityType.DOC_LEN;
        }
        paramInfo.similarity = similarity;
    }

    // need to do analysis on the term
    Analyzer analyzer = fp.getReq().getSchema().getIndexAnalyzer();
    paramInfo.analyzer = analyzer;
    try {
        List<String> terms = TermExtractionHelper.getTermsFromString(analyzer, paramInfo.field, textVal);
        paramInfo.terms = new HashSet<String>(terms);
    } catch (IOException e) {
        SolrException.log(log, "Exception during debug", e);
        return null;
    }
    return paramInfo;
}
 
開發者ID:DiceTechJobs,項目名稱:SolrPlugins,代碼行數:35,代碼來源:TermIntersectsValueSourceParser.java

示例14: getIndexSize

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
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;
}
 
開發者ID:europeana,項目名稱:search,代碼行數:16,代碼來源:ReplicationHandler.java

示例15: close

import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
protected void close() {
  Collection<SolrCore> coreList = new ArrayList<>();

  // It might be possible for one of the cores to move from one list to another while we're closing them. So
  // loop through the lists until they're all empty. In particular, the core could have moved from the transient
  // list to the pendingCloses list.

  do {
    coreList.clear();
    synchronized (modifyLock) {
      // make a copy of the cores then clear the map so the core isn't handed out to a request again
      coreList.addAll(cores.values());
      cores.clear();

      coreList.addAll(transientCores.values());
      transientCores.clear();

      coreList.addAll(pendingCloses);
      pendingCloses.clear();
    }

    for (SolrCore core : coreList) {
      try {
        core.close();
      } catch (Throwable e) {
        SolrException.log(CoreContainer.log, "Error shutting down core", e);
        if (e instanceof Error) {
          throw (Error) e;
        }
      }
    }
  } while (coreList.size() > 0);
}
 
開發者ID:europeana,項目名稱:search,代碼行數:34,代碼來源:SolrCores.java


注:本文中的org.apache.solr.common.SolrException.log方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。