com.atlassian.confluence.search.lucene.queue
Class IndexQueueTracker
java.lang.Object
com.atlassian.confluence.search.lucene.queue.IndexQueueTracker
- All Implemented Interfaces:
- org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean
public class IndexQueueTracker
- extends java.lang.Object
- implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
This tracker allows us to check whether there are any unflushed index queue entries without doing a database
query. By avoiding database queries we significantly reduce the load generated by idle instances that don't have any
index tasks being added to the queue.
This relies on local transaction synchronisation and also on the fact the IDs of index queue entries always increase
on a single node, so we always require flushing if we are in a clustered environment.
This component should be initialised (see initialiseLastQueueEntry(long entryId)
) so that it is
aware of the starting state of the index queue. If initialisation is missed then the index queue will not
be processed until the first enqueue(IndexQueueEntry)
call is made.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IndexQueueTracker
public IndexQueueTracker(SynchronizationManager synchronizationManager,
ClusterManager clusterManager,
com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar)
enqueue
public void enqueue(IndexQueueEntry e)
needsFlushing
public boolean needsFlushing()
flush
public void flush(java.util.Collection<IndexQueueEntry> entries)
onImportFinishedEvent
@EventListener
public void onImportFinishedEvent(ImportFinishedEvent event)
afterPropertiesSet
public void afterPropertiesSet()
throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
destroy
public void destroy()
throws java.lang.Exception
- Specified by:
destroy
in interface org.springframework.beans.factory.DisposableBean
- Throws:
java.lang.Exception
Copyright © 2003-2013 Atlassian. All Rights Reserved.