org.hibernate.search.backend.impl.batch
Class DefaultBatchBackend

java.lang.Object
  extended by org.hibernate.search.backend.impl.batch.DefaultBatchBackend
All Implemented Interfaces:
BatchBackend

public class DefaultBatchBackend
extends Object
implements BatchBackend

This is not meant to be used as a regular backend, only to apply batch changes to the index. Several threads are used to make changes to each index, so order of Work processing is not guaranteed.

Author:
Sanne Grinovero
Experimental
First BatchBackend

Constructor Summary
DefaultBatchBackend(SearchFactoryIntegrator searchFactoryImplementor, MassIndexerProgressMonitor progressMonitor)
           
 
Method Summary
 void doWorkInSync(LuceneWork work)
          Does one work in sync
 void enqueueAsyncWork(LuceneWork work)
          Enqueues one work to be processed asynchronously
 void flush(Set<Class<?>> entityTypes)
          Since most work is done async in the backend, we need to flush at the end to make sure we don't return control before all work was processed, and that IndexWriters are committed or closed.
 void optimize(Set<Class<?>> entityTypes)
          Triggers optimization of all indexes containing at least one instance of the listed targetedClasses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBatchBackend

public DefaultBatchBackend(SearchFactoryIntegrator searchFactoryImplementor,
                           MassIndexerProgressMonitor progressMonitor)
Method Detail

enqueueAsyncWork

public void enqueueAsyncWork(LuceneWork work)
                      throws InterruptedException
Description copied from interface: BatchBackend
Enqueues one work to be processed asynchronously

Specified by:
enqueueAsyncWork in interface BatchBackend
Throws:
InterruptedException - if the current thread is interrupted while waiting for the work queue to have enough space.

doWorkInSync

public void doWorkInSync(LuceneWork work)
Description copied from interface: BatchBackend
Does one work in sync

Specified by:
doWorkInSync in interface BatchBackend

flush

public void flush(Set<Class<?>> entityTypes)
Description copied from interface: BatchBackend
Since most work is done async in the backend, we need to flush at the end to make sure we don't return control before all work was processed, and that IndexWriters are committed or closed.

Specified by:
flush in interface BatchBackend

optimize

public void optimize(Set<Class<?>> entityTypes)
Description copied from interface: BatchBackend
Triggers optimization of all indexes containing at least one instance of the listed targetedClasses.

Specified by:
optimize in interface BatchBackend
Parameters:
entityTypes - Used to specify which indexes need optimization.


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved