SPT Object Database API

com.sptci.prevayler
Class IndexCloser

java.lang.Object
  extended by java.lang.Thread
      extended by com.sptci.prevayler.IndexCloser
All Implemented Interfaces:
Runnable

 class IndexCloser
extends Thread

A thread used to close an IndexReader and its associated IndexSearcher after all references to the index reader have been cleared.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: IndexCloser.java 22 2008-11-24 19:04:25Z sptrakesh $
Author:
Rakesh 2008-11-20

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  org.apache.lucene.index.IndexReader reader
          The index reader that is to be closed.
private  org.apache.lucene.search.IndexSearcher searcher
          The index search to be closed after the reader is closed.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IndexCloser(org.apache.lucene.index.IndexReader reader, org.apache.lucene.search.IndexSearcher searcher)
          Create a new index closer to close the specified reader and searchers.
 
Method Summary
private  void checkClosed()
          Loop through until the reader has been closed.
private  void closeReader()
          Close the reader instance.
private  void closeSearcher()
          Close the searcher instance.
 void run()
          Close the index reader and then sleep until the reader has really been closed.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

reader

private final org.apache.lucene.index.IndexReader reader
The index reader that is to be closed.


searcher

private final org.apache.lucene.search.IndexSearcher searcher
The index search to be closed after the reader is closed.

Constructor Detail

IndexCloser

IndexCloser(org.apache.lucene.index.IndexReader reader,
            org.apache.lucene.search.IndexSearcher searcher)
Create a new index closer to close the specified reader and searchers.

Parameters:
reader - The reader instance to close.
searcher - The searcher instance to close.
Method Detail

run

public void run()
Close the index reader and then sleep until the reader has really been closed. Once closed close the searcher as well.

Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
closeReader(), checkClosed()

closeReader

private void closeReader()
Close the reader instance.


checkClosed

private void checkClosed()
Loop through until the reader has been closed.


closeSearcher

private void closeSearcher()
Close the searcher instance.


SPT Object Database API