/** * Add a new file to be indexed * @param index the index * @param path the file */ public void index(LuceneLocalIndex index, String path) { Pair<String, LuceneLocalIndex> key = new Pair<>(path, index); synchronized (this._delayedLuceneIndexing) { AtomicInteger delay = this._delayedLuceneIndexing.get(key); // add it if not there if (delay == null) this._delayedLuceneIndexing.put(key, new AtomicInteger(this._delay)); // reset otherwise else delay.set(this._delay); } }
AtomicInteger timer = this._delayedLuceneIndexing.get(toIndex); if (timer.decrementAndGet() == 0) { LOGGER.debug("Re-indexing file {} after delay", toIndex.first()); config.getManager().index(toIndex.first(), LocalFileContentType.SINGLETON, toIndex.second(), req, Priority.HIGH, null); } else { IndexBatch batch = batches.get(toIndex.second().getIndexID()); if (batch == null) { batch = new IndexBatch(toIndex.second().getIndexID()); batches.put(batch.getIndex(), batch); config.getManager().indexBatch(batch, toIndex.first(), LocalFileContentType.SINGLETON, toIndex.second(), req, Priority.HIGH, null); AtomicInteger timer = this._delayedSolrIndexing.get(toIndex); if (timer.decrementAndGet() == 0) { LOGGER.debug("Re-indexing file {} after delay", toIndex.first()); config.getManager().index(toIndex.first(), LocalFileContentType.SINGLETON, toIndex.second(), req, Priority.HIGH, null); } else { IndexBatch batch = batches.get(toIndex.second().getIndexID()); if (batch == null) { batch = new IndexBatch(toIndex.second().getIndexID()); batches.put(batch.getIndex(), batch); config.getManager().indexBatch(batch, toIndex.first(), LocalFileContentType.SINGLETON, toIndex.second(), req, Priority.HIGH, null);
/** * Add a new file to be indexed * @param index the index * @param path the file */ public void index(SolrLocalIndex index, String path) { Pair<String, SolrLocalIndex> key = new Pair<>(path, index); synchronized (this._delayedSolrIndexing) { AtomicInteger delay = this._delayedSolrIndexing.get(key); // add it if not there if (delay == null) this._delayedSolrIndexing.put(key, new AtomicInteger(this._delay)); // reset otherwise else delay.set(this._delay); } }
/** * Handle the pattern attribute reporting duplicates and invalid patterns as warnings. * * @param pattern The URI pattern string to parse. * * @throws SAXException Only if thrown by underlying error handler. */ private void handlePattern(@Nullable String pattern) throws SAXException { if (pattern == null) { warning("Ignoring null pattern", null); return; } try { URIPattern p = new URIPattern(pattern); Pair<HttpMethod, URIPattern> k = new Pair<>(this.method, p); if (this._patternsToMethod.add(k)) { this._patterns.add(p); } else { warning("Ignoring duplicate pattern '"+p+"'", null); } } catch (IllegalArgumentException ex) { warning("Ignoring invalid pattern '"+pattern+"'", ex); } }