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

The following examples show how to use org.apache.lucene.util.Accountables. 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: lucene-solr   Source File: DirectoryTaxonomyReader.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public synchronized Collection<Accountable> getChildResources() {
  final List<Accountable> resources = new ArrayList<>();
  long ramBytesUsed = 0;
  for (LeafReaderContext ctx : indexReader.leaves()) {
    ramBytesUsed += ((SegmentReader) ctx.reader()).ramBytesUsed();
  }
  resources.add(Accountables.namedAccountable("indexReader", ramBytesUsed));
  if (taxoArrays != null) {
    resources.add(Accountables.namedAccountable("taxoArrays", taxoArrays));
  }

  synchronized (categoryCache) {
    resources.add(Accountables.namedAccountable("categoryCache", BYTES_PER_CACHE_ENTRY * categoryCache.size()));
  }    

  synchronized (ordinalCache) {
    resources.add(Accountables.namedAccountable("ordinalCache", BYTES_PER_CACHE_ENTRY * ordinalCache.size()));
  }    
  
  return Collections.unmodifiableList(resources);
}
 
Example 2
Source Project: Elasticsearch   Source File: Completion090PostingsFormat.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
    List<Accountable> resources = new ArrayList<>();
    if (lookupFactory != null) {
        resources.add(Accountables.namedAccountable("lookup", lookupFactory));
    }
    resources.add(Accountables.namedAccountable("delegate", delegateProducer));
    return Collections.unmodifiableList(resources);
}
 
Example 3
@Override
public Collection<Accountable> getChildResources() {
    if (fst != null) {
        return Collections.singleton(Accountables.namedAccountable("fst", fst));
    } else {
        return Collections.emptyList();
    }
}
 
Example 4
Source Project: Elasticsearch   Source File: MultiOrdinals.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
    List<Accountable> resources = new ArrayList<>();
    resources.add(Accountables.namedAccountable("offsets", endOffsets));
    resources.add(Accountables.namedAccountable("ordinals", ords));
    return Collections.unmodifiableCollection(resources);
}
 
Example 5
Source Project: Elasticsearch   Source File: PagedBytesAtomicFieldData.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
    List<Accountable> resources = new ArrayList<>();
    resources.add(Accountables.namedAccountable("ordinals", ordinals));
    resources.add(Accountables.namedAccountable("term bytes", bytes));
    resources.add(Accountables.namedAccountable("term offsets", termOrdToBytesOffset));
    return Collections.unmodifiableList(resources);
}
 
Example 6
@Override
public Collection<Accountable> getChildResources() {
    List<Accountable> resources = new ArrayList<>();
    resources.add(Accountables.namedAccountable("indexedPoints", indexedPoint));
    if (set != null) {
        resources.add(Accountables.namedAccountable("missing bitset", set));
    }
    return Collections.unmodifiableList(resources);
}
 
Example 7
@Override
public Collection<Accountable> getChildResources() {
    List<Accountable> resources = new ArrayList<>();
    resources.add(Accountables.namedAccountable("latitude", lat));
    resources.add(Accountables.namedAccountable("longitude", lon));
    return Collections.unmodifiableList(resources);
}
 
Example 8
@Override
public Collection<Accountable> getChildResources() {
    List<Accountable> resources = new ArrayList<>();
    resources.add(Accountables.namedAccountable("latitude", lat));
    resources.add(Accountables.namedAccountable("longitude", lon));
    if (set != null) {
        resources.add(Accountables.namedAccountable("missing bitset", set));
    }
    return Collections.unmodifiableList(resources);
}
 
Example 9
Source Project: Elasticsearch   Source File: Segment.java    License: Apache License 2.0 5 votes vote down vote up
Accountable readRamTree(StreamInput in) throws IOException {
    final String name = in.readString();
    final long bytes = in.readVLong();
    int numChildren = in.readVInt();
    if (numChildren == 0) {
        return Accountables.namedAccountable(name, bytes);
    }
    List<Accountable> children = new ArrayList(numChildren);
    while (numChildren-- > 0) {
        children.add(readRamTree(in));
    }
    return Accountables.namedAccountable(name, children, bytes);
}
 
Example 10
Source Project: lucene-solr   Source File: FSTTermsReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (dict == null) {
    return Collections.emptyList();
  } else {
    return Collections.singletonList(Accountables.namedAccountable("terms", dict));
  }
}
 
Example 11
Source Project: lucene-solr   Source File: OrdsFieldReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (index == null) {
    return Collections.emptyList();
  } else {
    return Collections.singleton(Accountables.namedAccountable("term index", index));
  }
}
 
Example 12
Source Project: lucene-solr   Source File: BlockTermsReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>();
  if (indexReader != null) {
    resources.add(Accountables.namedAccountable("term index", indexReader));
  }
  if (postingsReader != null) {
    resources.add(Accountables.namedAccountable("delegate", postingsReader));
  }
  return Collections.unmodifiableList(resources);
}
 
Example 13
Source Project: lucene-solr   Source File: VariableGapTermsIndexReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (fst == null) {
    return Collections.emptyList();
  } else {
    return Collections.singletonList(Accountables.namedAccountable("index data", fst));
  }
}
 
Example 14
Source Project: lucene-solr   Source File: FixedGapTermsIndexReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>();
  if (termOffsets != null) {
    resources.add(Accountables.namedAccountable("term lengths", termOffsets));
  }
  if (termsDictOffsets != null) {
    resources.add(Accountables.namedAccountable("offsets", termsDictOffsets));
  }
  return Collections.unmodifiableList(resources);
}
 
Example 15
Source Project: lucene-solr   Source File: SimpleTextFieldsReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (fst == null) {
    return Collections.emptyList();
  } else {
    return Collections.singletonList(Accountables.namedAccountable("term cache", fst));
  }
}
 
Example 16
Source Project: lucene-solr   Source File: BloomFilteringPostingsFormat.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>(Accountables.namedAccountables("field", bloomsByFieldName));
  if (delegateFieldsProducer != null) {
    resources.add(Accountables.namedAccountable("delegate", delegateFieldsProducer));
  }
  return Collections.unmodifiableList(resources);
}
 
Example 17
Source Project: lucene-solr   Source File: FreeTextSuggester.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (fst == null) {
    return Collections.emptyList();
  } else {
    return Collections.singletonList(Accountables.namedAccountable("fst", fst));
  }
}
 
Example 18
Source Project: lucene-solr   Source File: AnalyzingInfixSuggester.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>();
  try {
    if (searcherMgr != null) {
      SearcherManager mgr;
      IndexSearcher searcher;
      synchronized (searcherMgrLock) {
        mgr = searcherMgr; // acquire & release on same SearcherManager, via local reference
        searcher = mgr.acquire();
      }
      try {
        for (LeafReaderContext context : searcher.getIndexReader().leaves()) {
          LeafReader reader = FilterLeafReader.unwrap(context.reader());
          if (reader instanceof SegmentReader) {
            resources.add(Accountables.namedAccountable("segment", (SegmentReader)reader));
          }
        }
      } finally {
        mgr.release(searcher);
      }
    }
    return Collections.unmodifiableList(resources);
  } catch (IOException ioe) {
    throw new RuntimeException(ioe);
  }
}
 
Example 19
Source Project: lucene-solr   Source File: AnalyzingSuggester.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (fst == null) {
    return Collections.emptyList();
  } else {
    return Collections.singletonList(Accountables.namedAccountable("fst", fst));
  }
}
 
Example 20
Source Project: lucene-solr   Source File: FSTCompletionLookup.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>();
  if (normalCompletion != null) {
    resources.add(Accountables.namedAccountable("fst", normalCompletion.getFST()));
  }
  if (higherWeightsCompletion != null && (normalCompletion == null || normalCompletion.getFST() != higherWeightsCompletion.getFST())) {
    resources.add(Accountables.namedAccountable("higher weights fst", higherWeightsCompletion.getFST()));
  }
  return Collections.unmodifiableList(resources);
}
 
Example 21
Source Project: lucene-solr   Source File: WFSTCompletionLookup.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (fst == null) {
    return Collections.emptyList();
  } else {
    return Collections.singleton(Accountables.namedAccountable("fst", fst));
  }
}
 
Example 22
Source Project: lucene-solr   Source File: CompletionFieldsProducer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> accountableList = new ArrayList<>();
  for (Map.Entry<String, CompletionsTermsReader> readerEntry : readers.entrySet()) {
    accountableList.add(Accountables.namedAccountable(readerEntry.getKey(), readerEntry.getValue()));
  }
  return Collections.unmodifiableCollection(accountableList);
}
 
Example 23
/**
 * Returns nested resources of this class. 
 * The result should be a point-in-time snapshot (to avoid race conditions).
 * @see Accountables
 */
@Override
public Collection<Accountable> getChildResources() {
  synchronized (cachedOrdMaps) {
    return Accountables.namedAccountables("DefaultSortedSetDocValuesReaderState", cachedOrdMaps);
  }
}
 
Example 24
Source Project: lucene-solr   Source File: TaxonomyIndexArrays.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public synchronized Collection<Accountable> getChildResources() {
  final List<Accountable> resources = new ArrayList<>();
  resources.add(Accountables.namedAccountable("parents", RamUsageEstimator.shallowSizeOf(parents)));
  if (children != null) {
    resources.add(Accountables.namedAccountable("children", RamUsageEstimator.shallowSizeOf(children)));
  }
  if (siblings != null) {
    resources.add(Accountables.namedAccountable("siblings", RamUsageEstimator.shallowSizeOf(siblings)));
  }
  return Collections.unmodifiableList(resources);
}
 
Example 25
Source Project: lucene-solr   Source File: VersionFieldReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (index == null) {
    return Collections.emptyList();
  } else {
    return Collections.singletonList(Accountables.namedAccountable("term index", index));
  }
}
 
Example 26
Source Project: lucene-solr   Source File: FieldReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  if (index == null) {
    return Collections.emptyList();
  } else {
    return Collections.singleton(Accountables.namedAccountable("term index", index));
  }
}
 
Example 27
Source Project: lucene-solr   Source File: LRUQueryCache.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  lock.lock();
  try {
    return Accountables.namedAccountables("segment", cache);
  } finally {
    lock.unlock();
  }
}
 
Example 28
Source Project: lucene-solr   Source File: CodecReader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  ensureOpen();
  final List<Accountable> resources = new ArrayList<>(6);
  
  // terms/postings
  resources.add(Accountables.namedAccountable("postings", getPostingsReader()));
  
  // norms
  if (getNormsReader() != null) {
    resources.add(Accountables.namedAccountable("norms", getNormsReader()));
  }
  
  // docvalues
  if (getDocValuesReader() != null) {
    resources.add(Accountables.namedAccountable("docvalues", getDocValuesReader()));
  }
  
  // stored fields
  if (getFieldsReader() != null) {
    resources.add(Accountables.namedAccountable("stored fields", getFieldsReader()));
  }

  // term vectors
  if (getTermVectorsReader() != null) {
    resources.add(Accountables.namedAccountable("term vectors", getTermVectorsReader()));
  }

  // points
  if (getPointsReader() != null) {
    resources.add(Accountables.namedAccountable("points", getPointsReader()));
  }
  
  return Collections.unmodifiableList(resources);
}
 
Example 29
Source Project: lucene-solr   Source File: SegmentDocValuesProducer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  final List<Accountable> resources = new ArrayList<>(dvProducers.size());
  for (Accountable producer : dvProducers) {
    resources.add(Accountables.namedAccountable("delegate", producer));
  }
  return Collections.unmodifiableList(resources);
}
 
Example 30
Source Project: lucene-solr   Source File: OrdinalMap.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>();
  resources.add(Accountables.namedAccountable("global ord deltas", globalOrdDeltas));
  resources.add(Accountables.namedAccountable("first segments", firstSegments));
  resources.add(Accountables.namedAccountable("segment map", segmentMap));
  // TODO: would be nice to return actual child segment deltas too, but the optimizations are confusing
  return resources;
}