com.atlassian.confluence.search.lucene.queue
Class DatabaseQueueFlushedEntryCache

java.lang.Object
  extended by com.atlassian.confluence.search.lucene.queue.DatabaseQueueFlushedEntryCache

public class DatabaseQueueFlushedEntryCache
extends Object

Provides a cache of IndexQueueEntry objects that were added to the queue close to an index flush. Because the entry timestamps are stored in the database with only accuracy to the nearest second, these entries may be returned when the next flush runs, and we want to prevent rerunning them. The cacheWindowMillis controls the retention of the cache, and should be set to twice the database accuracy (typically 2000). Entries are added/kept if created within cacheWindowMillis milliseconds of a flush. Entries are removed if created outside cacheWindowMillis milliseconds of a flush.


Field Summary
static org.apache.log4j.Logger log
          Deprecated. 
 
Constructor Summary
DatabaseQueueFlushedEntryCache(long cacheWindowMillis)
           
 
Method Summary
 void add(IndexQueueEntry entry)
          Should only be used for testing.
 void addEntries(List entriesOldestFirst, Date relativeTo)
          Adds entries to the cache created on or after (relativeTo - cacheWindowMillis)
 boolean contains(IndexQueueEntry entry)
           
 void removeOldEntries(Date relativeTo)
          Removes items from the cache created before (relativeTo - cacheWindowMillis)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

@Deprecated
public static final org.apache.log4j.Logger log
Deprecated. 
Constructor Detail

DatabaseQueueFlushedEntryCache

public DatabaseQueueFlushedEntryCache(long cacheWindowMillis)
Parameters:
cacheWindowMillis - Controls timing for entry retention. Entries are added/kept if created within cacheWindowMillis milliseconds of a flush. Entries are removed if created outside cacheWindowMillis milliseconds of a flush.
Method Detail

add

public void add(IndexQueueEntry entry)
Should only be used for testing. Use addEntries() in production code.


contains

public boolean contains(IndexQueueEntry entry)

removeOldEntries

public void removeOldEntries(Date relativeTo)
Removes items from the cache created before (relativeTo - cacheWindowMillis)

Parameters:
relativeTo - typically when the current flush started

addEntries

public void addEntries(List entriesOldestFirst,
                       Date relativeTo)
Adds entries to the cache created on or after (relativeTo - cacheWindowMillis)

Parameters:
entriesOldestFirst - a list of entries sorted by creationDate ascending
relativeTo - typically when the current flush started


Copyright © 2003-2012 Atlassian. All Rights Reserved.