Example usage for org.apache.lucene.facet.taxonomy TaxonomyReader getRefCount

List of usage examples for org.apache.lucene.facet.taxonomy TaxonomyReader getRefCount

Introduction

In this page you can find the example usage for org.apache.lucene.facet.taxonomy TaxonomyReader getRefCount.

Prototype

public final int getRefCount() 

Source Link

Document

Returns the current refCount for this taxonomy reader.

Usage

From source file:org.fao.geonet.kernel.search.index.TaxonomyIndexTracker.java

License:Open Source License

TaxonomyReader acquire() throws IOException {
    if (taxonomyReader == null) {
        this.taxonomyReader = new DirectoryTaxonomyReader(taxonomyWriter);
    }//from w w w  .j  a v  a2  s.  c  o  m

    for (Iterator<TaxonomyReader> iterator = expiredReaders.iterator(); iterator.hasNext();) {
        TaxonomyReader reader = iterator.next();
        if (reader.getRefCount() < 1) {
            IOUtils.closeQuietly(reader);
            iterator.remove();
        }
    }

    return taxonomyReader;
}