org.apache.lucene.util.Accountables Java Examples

The following examples show how to use org.apache.lucene.util.Accountables. 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 File: DirectoryTaxonomyReader.java    From lucene-solr with 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 File: BloomFilteringPostingsFormat.java    From lucene-solr with 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 #3
Source File: AnalyzingCompletionLookupProvider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
    if (fst != null) {
        return Collections.singleton(Accountables.namedAccountable("fst", fst));
    } else {
        return Collections.emptyList();
    }
}
 
Example #4
Source File: FreeTextSuggester.java    From lucene-solr with 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 #5
Source File: AnalyzingInfixSuggester.java    From lucene-solr with 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 #6
Source File: AnalyzingSuggester.java    From lucene-solr with 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 #7
Source File: FSTCompletionLookup.java    From lucene-solr with 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 #8
Source File: WFSTCompletionLookup.java    From lucene-solr with 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 #9
Source File: CompletionFieldsProducer.java    From lucene-solr with 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 #10
Source File: DefaultSortedSetDocValuesReaderState.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * 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 #11
Source File: TaxonomyIndexArrays.java    From lucene-solr with 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 #12
Source File: VersionFieldReader.java    From lucene-solr with 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 #13
Source File: FieldReader.java    From lucene-solr with 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 #14
Source File: LRUQueryCache.java    From lucene-solr with 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 #15
Source File: CodecReader.java    From lucene-solr with 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 #16
Source File: SegmentDocValuesProducer.java    From lucene-solr with 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 #17
Source File: OrdinalMap.java    From lucene-solr with 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;
}
 
Example #18
Source File: FieldCacheImpl.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>(3);
  resources.add(Accountables.namedAccountable("term bytes", bytes));
  resources.add(Accountables.namedAccountable("ord -> term", termOrdToBytesOffset));
  resources.add(Accountables.namedAccountable("doc -> ord", docToTermOrd));
  return Collections.unmodifiableList(resources);
}
 
Example #19
Source File: FieldCacheImpl.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>(2);
  resources.add(Accountables.namedAccountable("term bytes", bytes));
  resources.add(Accountables.namedAccountable("addresses", docToOffset));
  return Collections.unmodifiableList(resources);
}
 
Example #20
Source File: MtasFieldsProducer.java    From mtas with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Accountable> getChildResources() {
  List<Accountable> resources = new ArrayList<>();
  if (delegateFieldsProducer != null) {
    resources.add(
        Accountables.namedAccountable("delegate", delegateFieldsProducer));
  }
  return Collections.unmodifiableList(resources);
}
 
Example #21
Source File: GeoPointArrayLegacyAtomicFieldData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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 #22
Source File: GeoPointArrayAtomicFieldData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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 #23
Source File: FixedGapTermsIndexReader.java    From lucene-solr with 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 #24
Source File: VariableGapTermsIndexReader.java    From lucene-solr with 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 #25
Source File: BlockTermsReader.java    From lucene-solr with 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 #26
Source File: OrdsFieldReader.java    From lucene-solr with 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 File: PagedBytesAtomicFieldData.java    From Elasticsearch with 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 #28
Source File: SimpleTextFieldsReader.java    From lucene-solr with 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 #29
Source File: Completion090PostingsFormat.java    From Elasticsearch with 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 #30
Source File: GeoPointArrayLegacyAtomicFieldData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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);
}