org.compass.core.lucene.engine.manager
Class IndexHoldersCache

java.lang.Object
  extended by org.compass.core.lucene.engine.manager.IndexHoldersCache

public class IndexHoldersCache
extends Object

A cache of LuceneIndexHolder. Provides APIs to get an index holder, manage its cache invalidation (either async or sync).

NOTE: All operations are not perfomed within a transactional context. The LuceneSearchEngineIndexManager provides transactionaly context for some of the operations.

Author:
kimchy

Field Summary
static String CLEAR_CACHE_NAME
           
 
Constructor Summary
IndexHoldersCache(LuceneSearchEngineIndexManager indexManager)
           
 
Method Summary
 void checkAndClearIfNotifiedAllToClearCache()
           
 void clearCache()
           
 void clearCache(String subIndex)
           
 void close()
           
 void doUnderCacheLock(String subIndex, Runnable task)
           
 ConcurrentMap<String,AtomicInteger> getDebugHoldersCount()
           
 LuceneIndexHolder getHolder(String subIndex)
          Returns an acquired index holder for the specified sub index.
 void invalidateCache()
           
 void invalidateCache(String subIndex)
           
 boolean isCached()
           
 boolean isCached(String subIndex)
           
 boolean isDebug()
           
 void notifyAllToClearCache()
           
 void refreshCache()
           
 void refreshCache(String subIndex)
           
protected  boolean shouldInvalidateCache(LuceneIndexHolder indexHolder)
          Checks if a an index holder should be invalidated.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEAR_CACHE_NAME

public static final String CLEAR_CACHE_NAME
See Also:
Constant Field Values
Constructor Detail

IndexHoldersCache

public IndexHoldersCache(LuceneSearchEngineIndexManager indexManager)
Method Detail

start

public void start()

stop

public void stop()

close

public void close()

isDebug

public boolean isDebug()

getDebugHoldersCount

public ConcurrentMap<String,AtomicInteger> getDebugHoldersCount()

doUnderCacheLock

public void doUnderCacheLock(String subIndex,
                             Runnable task)

isCached

public boolean isCached(String subIndex)
                 throws SearchEngineException
Throws:
SearchEngineException

isCached

public boolean isCached()
                 throws SearchEngineException
Throws:
SearchEngineException

clearCache

public void clearCache()
                throws SearchEngineException
Throws:
SearchEngineException

clearCache

public void clearCache(String subIndex)
                throws SearchEngineException
Throws:
SearchEngineException

refreshCache

public void refreshCache()
                  throws SearchEngineException
Throws:
SearchEngineException

refreshCache

public void refreshCache(String subIndex)
                  throws SearchEngineException
Throws:
SearchEngineException

invalidateCache

public void invalidateCache()
                     throws SearchEngineException
Throws:
SearchEngineException

invalidateCache

public void invalidateCache(String subIndex)
                     throws SearchEngineException
Throws:
SearchEngineException

checkAndClearIfNotifiedAllToClearCache

public void checkAndClearIfNotifiedAllToClearCache()
                                            throws SearchEngineException
Throws:
SearchEngineException

notifyAllToClearCache

public void notifyAllToClearCache()
                           throws SearchEngineException
Throws:
SearchEngineException

getHolder

public LuceneIndexHolder getHolder(String subIndex)
                            throws SearchEngineException
Returns an acquired index holder for the specified sub index. Make sure to call LuceneIndexHolder.release() once it is no longer needed.

Throws:
SearchEngineException

shouldInvalidateCache

protected boolean shouldInvalidateCache(LuceneIndexHolder indexHolder)
                                 throws IOException
Checks if a an index holder should be invalidated.

Throws:
IOException


Copyright (c) 2004-2009 The Compass Project.