当前位置: 首页>>代码示例>>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;未经允许,请勿转载。