Package org.springmodules.lucene.index.factory

Examples of org.springmodules.lucene.index.factory.IndexHolder


   * the index during a long time.
   * @see org.springmodules.resource.ResourceManager#open()
   */
  public void doOpen() {
    //The Lucene reader and writer will opened lazily at their first use
    IndexHolder holder=new IndexHolder(null,null);
    ResourceBindingManager.bindResource(getIndexFactory(), holder);
  }
View Full Code Here


   * @see org.springmodules.resource.ResourceManager#close()
   * @see IndexReaderFactoryUtils#releaseIndexReader(IndexFactory, IndexReader)
   * @see IndexWriterFactoryUtils#releaseIndexWriter(IndexFactory, IndexWriter)
   */
  public void doClose() {
    IndexHolder holder=(IndexHolder)ResourceBindingManager.getResource(this.indexFactory);

    // Remove the resource holder from the thread.
    ResourceBindingManager.unbindResource(this.indexFactory);

    // Close index.
    IndexReader indexReader = holder.getIndexReader();
    if (logger.isDebugEnabled()) {
      logger.debug("Closing Lucene indexReader [" + indexReader + "]");
    }
    IndexReaderFactoryUtils.releaseIndexReader(this.indexFactory,indexReader);

    IndexWriter indexWriter = holder.getIndexWriter();
    if (logger.isDebugEnabled()) {
      logger.debug("Closing Lucene indexWriter [" + indexWriter + "]");
    }
    IndexWriterFactoryUtils.releaseIndexWriter(this.indexFactory,indexWriter);
  }
View Full Code Here

TOP

Related Classes of org.springmodules.lucene.index.factory.IndexHolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.