Java Code Examples for org.apache.lucene.util.Counter

The following examples show how to use org.apache.lucene.util.Counter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Elasticsearch   Source File: CrateSearchContext.java    License: Apache License 2.0 6 votes vote down vote up
public CrateSearchContext(long id,
                          final long nowInMillis,
                          SearchShardTarget shardTarget,
                          Engine.Searcher engineSearcher,
                          IndexService indexService,
                          final IndexShard indexShard,
                          ScriptService scriptService,
                          PageCacheRecycler pageCacheRecycler,
                          BigArrays bigArrays,
                          Counter timeEstimateCounter,
                          Optional<Scroll> scroll) {
    super(id, new CrateSearchShardRequest(nowInMillis, scroll, indexShard),
            shardTarget, engineSearcher, indexService,
            indexShard, scriptService, pageCacheRecycler,
            bigArrays, timeEstimateCounter, ParseFieldMatcher.STRICT, SearchService.NO_TIMEOUT);
    this.engineSearcher = engineSearcher;
}
 
Example 2
Source Project: Elasticsearch   Source File: DefaultSearchContext.java    License: Apache License 2.0 6 votes vote down vote up
public DefaultSearchContext(long id, ShardSearchRequest request, SearchShardTarget shardTarget,
                            Engine.Searcher engineSearcher, IndexService indexService, IndexShard indexShard,
                            ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
                            BigArrays bigArrays, Counter timeEstimateCounter, ParseFieldMatcher parseFieldMatcher,
                            TimeValue timeout
) {
    super(parseFieldMatcher, request);
    this.id = id;
    this.request = request;
    this.searchType = request.searchType();
    this.shardTarget = shardTarget;
    this.engineSearcher = engineSearcher;
    this.scriptService = scriptService;
    this.pageCacheRecycler = pageCacheRecycler;
    // SearchContexts use a BigArrays that can circuit break
    this.bigArrays = bigArrays.withCircuitBreaking();
    this.dfsResult = new DfsSearchResult(id, shardTarget);
    this.queryResult = new QuerySearchResult(id, shardTarget);
    this.fetchResult = new FetchSearchResult(id, shardTarget);
    this.indexShard = indexShard;
    this.indexService = indexService;
    this.searcher = new ContextIndexSearcher(engineSearcher, indexService.cache().query(), indexShard.getQueryCachingPolicy());
    this.timeEstimateCounter = timeEstimateCounter;
    this.timeoutInMillis = timeout.millis();
}
 
Example 3
Source Project: lucene-solr   Source File: TestFieldUpdatesBuffer.java    License: Apache License 2.0 6 votes vote down vote up
public void testNumericRandom() throws IOException {
  List<DocValuesUpdate.NumericDocValuesUpdate> updates = new ArrayList<>();
  int numUpdates = 1 + random().nextInt(1000);
  Counter counter = Counter.newCounter();
  DocValuesUpdate.NumericDocValuesUpdate randomUpdate = getRandomNumericUpdate();
  updates.add(randomUpdate);
  FieldUpdatesBuffer buffer = new FieldUpdatesBuffer(counter, randomUpdate, randomUpdate.docIDUpto);
  for (int i = 0; i < numUpdates; i++) {
    randomUpdate = getRandomNumericUpdate();
    updates.add(randomUpdate);
    if (randomUpdate.hasValue) {
      buffer.addUpdate(randomUpdate.term, randomUpdate.getValue(), randomUpdate.docIDUpto);
    } else {
      buffer.addNoValue(randomUpdate.term, randomUpdate.docIDUpto);
    }
  }
  buffer.finish();
  DocValuesUpdate.NumericDocValuesUpdate lastUpdate = randomUpdate;
  boolean termsSorted = lastUpdate.hasValue && updates.stream()
      .allMatch(update -> update.field.equals(lastUpdate.field) &&
          update.hasValue && update.getValue() == lastUpdate.getValue());
  assertBufferUpdates(buffer, updates, termsSorted);
}
 
Example 4
Source Project: lucene-solr   Source File: TestFieldUpdatesBuffer.java    License: Apache License 2.0 6 votes vote down vote up
public void testSortAndDedupNumericUpdatesByTerms() throws IOException {
  List<DocValuesUpdate.NumericDocValuesUpdate> updates = new ArrayList<>();
  int numUpdates = 1 + random().nextInt(1000);
  Counter counter = Counter.newCounter();
  String termField = RandomPicks.randomFrom(random(), Arrays.asList("id", "_id", "some_other_field"));
  long docValue = 1 + random().nextInt(1000);
  DocValuesUpdate.NumericDocValuesUpdate randomUpdate = new DocValuesUpdate.NumericDocValuesUpdate(
      new Term(termField, Integer.toString(random().nextInt(1000))), "numeric", docValue);
  randomUpdate = randomUpdate.prepareForApply(randomDocUpTo());
  updates.add(randomUpdate);
  FieldUpdatesBuffer buffer = new FieldUpdatesBuffer(counter, randomUpdate, randomUpdate.docIDUpto);
  for (int i = 0; i < numUpdates; i++) {
    randomUpdate = new DocValuesUpdate.NumericDocValuesUpdate(
        new Term(termField, Integer.toString(random().nextInt(1000))), "numeric", docValue);
    randomUpdate = randomUpdate.prepareForApply(randomDocUpTo());
    updates.add(randomUpdate);
    buffer.addUpdate(randomUpdate.term, randomUpdate.getValue(), randomUpdate.docIDUpto);
  }
  buffer.finish();
  assertBufferUpdates(buffer, updates, true);
}
 
Example 5
private void readFromBytes(BytesRef bytes) {
  // Read pruned flag
  this.setIsPruned(bytes.bytes[bytes.offset++] == 1 ? true : false);

  // Read size fo the set
  int size = Bytes.readInt(bytes);

  // Read terms
  bytesUsed = Counter.newCounter();
  pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed));
  set = new BytesRefHash(pool);

  BytesRef reusable = new BytesRef();
  for (int i = 0; i < size; i++) {
    Bytes.readBytesRef(bytes, reusable);
    set.add(reusable);
  }
}
 
Example 6
@Override
public void collect(int doc) throws IOException 
{
    if(sortedDocValues != null)
    {
        int ordinal = sortedDocValues.getOrd(doc);
        if(ordinal > -1)
        {
            String value = (String)schemaField.getType().toObject(schemaField, sortedDocValues.lookupOrd(ordinal));
            String group = doGroup ? mappings.get(value) : value;
            if(group == null)
            {
                group = value;
            }

            Counter counter = counters.get(group);
            if(counter == null)
            {
                counter = Counter.newCounter();
                counters.put(group, counter);
            }
            counter.addAndGet(1);
        }
    }


    leafDelegate.collect(doc);
}
 
Example 7
public void finish() throws IOException 
{
    NamedList<Object> analytics = new NamedList<>();
    rb.rsp.add("analytics", analytics);
    NamedList<Object> fieldCounts = new NamedList<>(); 
    analytics.add("mimetype()", fieldCounts);
    for (Entry<String, Counter> counter : counters.entrySet())
    {
        fieldCounts.add(counter.getKey(), counter.getValue().get());
    }
    
    if(this.delegate instanceof DelegatingCollector) {
        ((DelegatingCollector)this.delegate).finish();
    }
}
 
Example 8
Source Project: lucene-solr   Source File: TermsHash.java    License: Apache License 2.0 5 votes vote down vote up
TermsHash(final DocumentsWriterPerThread docWriter, boolean trackAllocations, TermsHash nextTermsHash) {
  this.trackAllocations = trackAllocations;
  this.nextTermsHash = nextTermsHash;
  this.bytesUsed = trackAllocations ? docWriter.bytesUsed : Counter.newCounter();
  intPool = new IntBlockPool(docWriter.intBlockAllocator);
  bytePool = new ByteBlockPool(docWriter.byteBlockAllocator);

  if (nextTermsHash != null) {
    // We are primary
    termBytePool = bytePool;
    nextTermsHash.termBytePool = bytePool;
  }
}
 
Example 9
Source Project: lucene-solr   Source File: BinaryDocValuesWriter.java    License: Apache License 2.0 5 votes vote down vote up
public BinaryDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) {
  this.fieldInfo = fieldInfo;
  this.bytes = new PagedBytes(BLOCK_BITS);
  this.bytesOut = bytes.getDataOutput();
  this.lengths = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT);
  this.iwBytesUsed = iwBytesUsed;
  this.docsWithField = new DocsWithFieldSet();
  this.bytesUsed = lengths.ramBytesUsed() + docsWithField.ramBytesUsed();
  iwBytesUsed.addAndGet(bytesUsed);
}
 
Example 10
Source Project: lucene-solr   Source File: SortedSetDocValuesWriter.java    License: Apache License 2.0 5 votes vote down vote up
public SortedSetDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) {
  this.fieldInfo = fieldInfo;
  this.iwBytesUsed = iwBytesUsed;
  hash = new BytesRefHash(
      new ByteBlockPool(
          new ByteBlockPool.DirectTrackingAllocator(iwBytesUsed)),
          BytesRefHash.DEFAULT_CAPACITY,
          new DirectBytesStartArray(BytesRefHash.DEFAULT_CAPACITY, iwBytesUsed));
  pending = PackedLongValues.packedBuilder(PackedInts.COMPACT);
  pendingCounts = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT);
  docsWithField = new DocsWithFieldSet();
  bytesUsed = pending.ramBytesUsed() + pendingCounts.ramBytesUsed();
  iwBytesUsed.addAndGet(bytesUsed);
}
 
Example 11
Source Project: lucene-solr   Source File: SortedDocValuesWriter.java    License: Apache License 2.0 5 votes vote down vote up
public SortedDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) {
  this.fieldInfo = fieldInfo;
  this.iwBytesUsed = iwBytesUsed;
  hash = new BytesRefHash(
      new ByteBlockPool(
          new ByteBlockPool.DirectTrackingAllocator(iwBytesUsed)),
          BytesRefHash.DEFAULT_CAPACITY,
          new DirectBytesStartArray(BytesRefHash.DEFAULT_CAPACITY, iwBytesUsed));
  pending = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT);
  docsWithField = new DocsWithFieldSet();
  bytesUsed = pending.ramBytesUsed() + docsWithField.ramBytesUsed();
  iwBytesUsed.addAndGet(bytesUsed);
}
 
Example 12
Source Project: lucene-solr   Source File: TermsHashPerField.java    License: Apache License 2.0 5 votes vote down vote up
/** streamCount: how many streams this field stores per term.
 * E.g. doc(+freq) is 1 stream, prox+offset is a second. */
TermsHashPerField(int streamCount, IntBlockPool intPool, ByteBlockPool bytePool, ByteBlockPool termBytePool,
                  Counter bytesUsed, TermsHashPerField nextPerField, String fieldName, IndexOptions indexOptions) {
  this.intPool = intPool;
  this.bytePool = bytePool;
  this.streamCount = streamCount;
  this.fieldName = fieldName;
  this.nextPerField = nextPerField;
  assert indexOptions != IndexOptions.NONE;
  this.indexOptions = indexOptions;
  PostingsBytesStartArray byteStarts = new PostingsBytesStartArray(this, bytesUsed);
  bytesHash = new BytesRefHash(termBytePool, HASH_INIT_SIZE, byteStarts);
}
 
Example 13
Source Project: lucene-solr   Source File: NumericDocValuesWriter.java    License: Apache License 2.0 5 votes vote down vote up
public NumericDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) {
  pending = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT);
  docsWithField = new DocsWithFieldSet();
  bytesUsed = pending.ramBytesUsed() + docsWithField.ramBytesUsed();
  this.fieldInfo = fieldInfo;
  this.iwBytesUsed = iwBytesUsed;
  iwBytesUsed.addAndGet(bytesUsed);
}
 
Example 14
Source Project: lucene-solr   Source File: NormValuesWriter.java    License: Apache License 2.0 5 votes vote down vote up
public NormValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) {
  docsWithField = new DocsWithFieldSet();
  pending = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT);
  bytesUsed = pending.ramBytesUsed() + docsWithField.ramBytesUsed();
  this.fieldInfo = fieldInfo;
  this.iwBytesUsed = iwBytesUsed;
  iwBytesUsed.addAndGet(bytesUsed);
}
 
Example 15
Source Project: lucene-solr   Source File: SortedNumericDocValuesWriter.java    License: Apache License 2.0 5 votes vote down vote up
public SortedNumericDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) {
  this.fieldInfo = fieldInfo;
  this.iwBytesUsed = iwBytesUsed;
  pending = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT);
  pendingCounts = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT);
  docsWithField = new DocsWithFieldSet();
  bytesUsed = pending.ramBytesUsed() + pendingCounts.ramBytesUsed() + docsWithField.ramBytesUsed() + RamUsageEstimator.sizeOf(currentValues);
  iwBytesUsed.addAndGet(bytesUsed);
}
 
Example 16
Source Project: lucene-solr   Source File: FieldUpdatesBuffer.java    License: Apache License 2.0 5 votes vote down vote up
private FieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate initialValue, int docUpTo, boolean isNumeric) {
  this.bytesUsed = bytesUsed;
  this.bytesUsed.addAndGet(SELF_SHALLOW_SIZE);
  termValues = new BytesRefArray(bytesUsed);
  termValues.append(initialValue.term.bytes);
  fields = new String[] {initialValue.term.field};
  bytesUsed.addAndGet(sizeOfString(initialValue.term.field));
  docsUpTo = new int[] {docUpTo};
  if (initialValue.hasValue == false) {
    hasValues = new FixedBitSet(1);
    bytesUsed.addAndGet(hasValues.ramBytesUsed());
  }
  this.isNumeric = isNumeric;
  byteValues = isNumeric ? null : new BytesRefArray(bytesUsed);
}
 
Example 17
Source Project: lucene-solr   Source File: FieldUpdatesBuffer.java    License: Apache License 2.0 5 votes vote down vote up
FieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate.NumericDocValuesUpdate initialValue, int docUpTo) {
  this(bytesUsed, initialValue, docUpTo, true);
  if (initialValue.hasValue()) {
    numericValues = new long[] {initialValue.getValue()};
    maxNumeric = minNumeric = initialValue.getValue();
  } else {
    numericValues = new long[] {0};
  }
  bytesUsed.addAndGet(Long.BYTES);
}
 
Example 18
Source Project: lucene-solr   Source File: TestIntBlockPool.java    License: Apache License 2.0 5 votes vote down vote up
public void testSingleWriterReader() {
  Counter bytesUsed = Counter.newCounter();
  IntBlockPool pool = new IntBlockPool(new ByteTrackingAllocator(bytesUsed));
  
  for (int j = 0; j < 2; j++) {
    IntBlockPool.SliceWriter writer = new IntBlockPool.SliceWriter(pool);
    int start = writer.startNewSlice();
    int num = atLeast(100);
    for (int i = 0; i < num; i++) {
      writer.writeInt(i);
    }
    
    int upto = writer.getCurrentOffset();
    IntBlockPool.SliceReader reader = new IntBlockPool.SliceReader(pool);
    reader.reset(start, upto);
    for (int i = 0; i < num; i++) {
      assertEquals(i, reader.readInt());
    }
    assertTrue(reader.endOfSlice());
    if (random().nextBoolean()) {
      pool.reset(true, false);
      assertEquals(0, bytesUsed.get());
    } else {
      pool.reset(true, true);
      assertEquals(IntBlockPool.INT_BLOCK_SIZE * Integer.BYTES, bytesUsed.get());
    }
  }
}
 
Example 19
Source Project: lucene-solr   Source File: TestFieldUpdatesBuffer.java    License: Apache License 2.0 5 votes vote down vote up
public void testUpdateShareValues() throws IOException {
  Counter counter = Counter.newCounter();
  int intValue = random().nextInt();
  boolean valueForThree = random().nextBoolean();
  DocValuesUpdate.NumericDocValuesUpdate update =
      new DocValuesUpdate.NumericDocValuesUpdate(new Term("id", "0"), "enabled", intValue);
  FieldUpdatesBuffer buffer = new FieldUpdatesBuffer(counter, update, Integer.MAX_VALUE);
  buffer.addUpdate(new Term("id", "1"), intValue, Integer.MAX_VALUE);
  buffer.addUpdate(new Term("id", "2"), intValue, Integer.MAX_VALUE);
  if (valueForThree) {
    buffer.addUpdate(new Term("id", "3"), intValue, Integer.MAX_VALUE);
  } else {
    buffer.addNoValue(new Term("id", "3"), Integer.MAX_VALUE);
  }
  buffer.addUpdate(new Term("id", "4"), intValue, Integer.MAX_VALUE);
  buffer.finish();
  FieldUpdatesBuffer.BufferedUpdateIterator iterator = buffer.iterator();
  FieldUpdatesBuffer.BufferedUpdate value;
  int count = 0;
  while ((value = iterator.next()) != null) {
    boolean hasValue = count != 3 || valueForThree;
    assertEquals("" + (count++), value.termValue.utf8ToString());
    assertEquals("id", value.termField);
    assertEquals(hasValue, value.hasValue);
    if (hasValue) {
      assertEquals(intValue, value.numericValue);
    } else {
      assertEquals(0, value.numericValue);
    }
    assertEquals(Integer.MAX_VALUE, value.docUpTo);
  }
  assertTrue(buffer.isNumeric());
}
 
Example 20
Source Project: lucene-solr   Source File: TestFieldUpdatesBuffer.java    License: Apache License 2.0 5 votes vote down vote up
public void testUpdateShareValuesBinary() throws IOException {
  Counter counter = Counter.newCounter();
  boolean valueForThree = random().nextBoolean();
  DocValuesUpdate.BinaryDocValuesUpdate update =
      new DocValuesUpdate.BinaryDocValuesUpdate(new Term("id", "0"), "enabled", new BytesRef(""));
  FieldUpdatesBuffer buffer = new FieldUpdatesBuffer(counter, update, Integer.MAX_VALUE);
  buffer.addUpdate(new Term("id", "1"), new BytesRef(""), Integer.MAX_VALUE);
  buffer.addUpdate(new Term("id", "2"), new BytesRef(""), Integer.MAX_VALUE);
  if (valueForThree) {
    buffer.addUpdate(new Term("id", "3"), new BytesRef(""), Integer.MAX_VALUE);
  } else {
    buffer.addNoValue(new Term("id", "3"), Integer.MAX_VALUE);
  }
  buffer.addUpdate(new Term("id", "4"), new BytesRef(""), Integer.MAX_VALUE);
  buffer.finish();
  FieldUpdatesBuffer.BufferedUpdateIterator iterator = buffer.iterator();
  FieldUpdatesBuffer.BufferedUpdate value;
  int count = 0;
  while ((value = iterator.next()) != null) {
    boolean hasValue = count != 3 || valueForThree;
    assertEquals("" + (count++), value.termValue.utf8ToString());
    assertEquals("id", value.termField);
    assertEquals(hasValue, value.hasValue);
    if (hasValue) {
      assertEquals(new BytesRef(""), value.binaryValue);
    } else {
      assertNull(value.binaryValue);
    }
    assertEquals(Integer.MAX_VALUE, value.docUpTo);
  }
  assertFalse(buffer.isNumeric());
}
 
Example 21
Source Project: lucene-solr   Source File: TestFieldUpdatesBuffer.java    License: Apache License 2.0 5 votes vote down vote up
public void testBinaryRandom() throws IOException {
  List<DocValuesUpdate.BinaryDocValuesUpdate> updates = new ArrayList<>();
  int numUpdates = 1 + random().nextInt(1000);
  Counter counter = Counter.newCounter();
  DocValuesUpdate.BinaryDocValuesUpdate randomUpdate = getRandomBinaryUpdate();
  updates.add(randomUpdate);
  FieldUpdatesBuffer buffer = new FieldUpdatesBuffer(counter, randomUpdate, randomUpdate.docIDUpto);
  for (int i = 0; i < numUpdates; i++) {
    randomUpdate = getRandomBinaryUpdate();
    updates.add(randomUpdate);
    if (randomUpdate.hasValue) {
      buffer.addUpdate(randomUpdate.term, randomUpdate.getValue(), randomUpdate.docIDUpto);
    } else {
      buffer.addNoValue(randomUpdate.term, randomUpdate.docIDUpto);
    }
  }
  buffer.finish();
  FieldUpdatesBuffer.BufferedUpdateIterator iterator = buffer.iterator();
  FieldUpdatesBuffer.BufferedUpdate value;

  int count = 0;
  while ((value = iterator.next()) != null) {
    randomUpdate = updates.get(count++);
    assertEquals(randomUpdate.term.bytes.utf8ToString(), value.termValue.utf8ToString());
    assertEquals(randomUpdate.term.field, value.termField);
    assertEquals("count: " + count, randomUpdate.hasValue, value.hasValue);
    if (randomUpdate.hasValue) {
      assertEquals(randomUpdate.getValue(), value.binaryValue);
    } else {
      assertNull(value.binaryValue);
    }
    assertEquals(randomUpdate.docIDUpto, value.docUpTo);
  }
  assertEquals(count, updates.size());
}
 
Example 22
Source Project: lucene-solr   Source File: TestFieldUpdatesBuffer.java    License: Apache License 2.0 5 votes vote down vote up
public void testNoNumericValue() {
  DocValuesUpdate.NumericDocValuesUpdate update =
      new DocValuesUpdate.NumericDocValuesUpdate(new Term("id", "1"), "age", null);
  FieldUpdatesBuffer buffer = new FieldUpdatesBuffer(Counter.newCounter(), update, update.docIDUpto);
  assertEquals(0, buffer.getMinNumeric());
  assertEquals(0, buffer.getMaxNumeric());
}
 
Example 23
@Override
public void readFrom(StreamInput in) throws IOException {
  this.setIsPruned(in.readBoolean());
  int size = in.readInt();

  bytesUsed = Counter.newCounter();
  pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed));
  set = new BytesRefHash(pool);

  for (long i = 0; i < size; i++) {
    set.add(in.readBytesRef());
  }
}
 
Example 24
Source Project: crate   Source File: TranslogDeletionPolicy.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * releases a generation that was acquired by {@link #acquireTranslogGen(long)}
 */
private synchronized void releaseTranslogGen(long translogGen) {
    Counter current = translogRefCounts.get(translogGen);
    if (current == null || current.get() <= 0) {
        throw new IllegalArgumentException("translog gen [" + translogGen + "] wasn't acquired");
    }
    if (current.addAndGet(-1) == 0) {
        translogRefCounts.remove(translogGen);
    }
}
 
Example 25
Source Project: Elasticsearch   Source File: PercolateContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Counter timeEstimateCounter() {
    throw new UnsupportedOperationException();
}
 
Example 26
Source Project: Elasticsearch   Source File: FilteredSearchContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Counter timeEstimateCounter() {
    return in.timeEstimateCounter();
}
 
Example 27
Source Project: Elasticsearch   Source File: SubSearchContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Counter timeEstimateCounter() {
    throw new UnsupportedOperationException("Not supported");
}
 
Example 28
Source Project: Elasticsearch   Source File: DefaultSearchContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Counter timeEstimateCounter() {
    return timeEstimateCounter;
}
 
Example 29
Source Project: Elasticsearch   Source File: Lucene.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Wraps <code>delegate</code> with a time limited collector with a timeout of <code>timeoutInMillis</code>
 */
public final static TimeLimitingCollector wrapTimeLimitingCollector(final Collector delegate, final Counter counter, long timeoutInMillis) {
    return new TimeLimitingCollector(delegate, counter, timeoutInMillis);
}
 
Example 30
Source Project: Elasticsearch   Source File: ThreadPool.java    License: Apache License 2.0 4 votes vote down vote up
public Counter estimatedTimeInMillisCounter() {
    return estimatedTimeThread.counter;
}