org.sakaiproject.search.optimize.impl
Class OptimizeTransactionListenerImpl

java.lang.Object
  extended by org.sakaiproject.search.optimize.impl.OptimizeTransactionListenerImpl
All Implemented Interfaces:
OptimizeTransactionListener, TransactionListener

public class OptimizeTransactionListenerImpl
extends Object
implements OptimizeTransactionListener

An OptimizationTransactionListener that optimizes the index. It first collects the segments that could be optimized. If ther are more than the mergeSize then it will perform the merge into a temporary segment and if that is successfull that index will be merged in the commit phase into the permanent index

Author:
ieb

Constructor Summary
OptimizeTransactionListenerImpl()
           
 
Method Summary
 void close(IndexTransaction transaction)
           
 void commit(IndexTransaction transaction)
          commit closes the temporary segment, and merges it into the permanent segment.
 void destroy()
           
 JournalSettings getJournalSettings()
           
 OptimizableIndex getOptimizableIndex()
           
 void init()
           
 void open(IndexTransaction transaction)
          Open the index, but throw a NoOptimizationReqiredException if there are not enough segments to perfom a merge on
 void prepare(IndexTransaction transaction)
          Perform the merge operation on the segments into a temporary segment, open the permanent segment to ensure that a writer lock can be aquired
 void rollback(IndexTransaction transaction)
          Roll back the optimize operation
 void setJournalSettings(JournalSettings journalSettings)
           
 void setOptimizableIndex(OptimizableIndex optimizableIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimizeTransactionListenerImpl

public OptimizeTransactionListenerImpl()
Method Detail

init

public void init()

destroy

public void destroy()

close

public void close(IndexTransaction transaction)
           throws IndexTransactionException
Specified by:
close in interface TransactionListener
Throws:
IndexTransactionException
See Also:
TransactionListener.close(org.sakaiproject.search.transaction.api.IndexTransaction)

commit

public void commit(IndexTransaction transaction)
            throws IndexTransactionException
commit closes the temporary segment, and merges it into the permanent segment. Both the temporary and permanent were opened in the prepare phase

Specified by:
commit in interface TransactionListener
Throws:
IndexTransactionException
See Also:
TransactionListener.commit(org.sakaiproject.search.transaction.api.IndexTransaction)

open

public void open(IndexTransaction transaction)
          throws IndexTransactionException
Open the index, but throw a NoOptimizationReqiredException if there are not enough segments to perfom a merge on

Specified by:
open in interface TransactionListener
Throws:
IndexTransactionException
See Also:
TransactionListener.open(org.sakaiproject.search.transaction.api.IndexTransaction)

prepare

public void prepare(IndexTransaction transaction)
             throws IndexTransactionException
Perform the merge operation on the segments into a temporary segment, open the permanent segment to ensure that a writer lock can be aquired

Specified by:
prepare in interface TransactionListener
Throws:
IndexJournalException
IndexTransactionException
See Also:
TransactionListener.prepare(org.sakaiproject.search.transaction.api.IndexTransaction)

rollback

public void rollback(IndexTransaction transaction)
              throws IndexTransactionException
Roll back the optimize operation

Specified by:
rollback in interface TransactionListener
Throws:
IndexTransactionException
See Also:
TransactionListener.rollback(org.sakaiproject.search.transaction.api.IndexTransaction)

getOptimizableIndex

public OptimizableIndex getOptimizableIndex()
Returns:
the optimizableIndex

setOptimizableIndex

public void setOptimizableIndex(OptimizableIndex optimizableIndex)
Parameters:
optimizableIndex - the optimizableIndex to set

getJournalSettings

public JournalSettings getJournalSettings()
Returns:
the journalSettings

setJournalSettings

public void setJournalSettings(JournalSettings journalSettings)
Parameters:
journalSettings - the journalSettings to set


Copyright © 2003-2012 Sakai Project. All Rights Reserved.