本文整理匯總了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);
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
}
示例7: closeCallbackExecutor
import org.apache.solr.common.SolrException; //導入方法依賴的package包/類
private void closeCallbackExecutor() {
try {
ExecutorUtil.shutdownAndAwaitTermination(zkCallbackExecutor);
} catch (Exception e) {
SolrException.log(log, e);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
}
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}