org.hibernate.search.backend.impl.batchlucene
Class LuceneBatchBackend

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

public class LuceneBatchBackend
extends java.lang.Object
implements BatchBackend

First EXPERIMENTAL 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

Field Summary
static java.lang.String CONCURRENT_WRITERS
           
 
Constructor Summary
LuceneBatchBackend()
           
 
Method Summary
 void close()
          Used to shutdown and release resources.
 void doWorkInSync(LuceneWork work)
          Does one work in sync
 void enqueueAsyncWork(LuceneWork work)
          Enqueues one work to be processed asynchronously
 void initialize(java.util.Properties cfg, MassIndexerProgressMonitor monitor, SearchFactoryImplementor searchFactoryImplementor)
          Used at startup, called once as first method.
 void stopAndFlush(long timeout, java.util.concurrent.TimeUnit unit)
          Stops the background threads and flushes changes; Please note the timeout is applied to each index in sequence, so it might take as much time as timeout*directoryproviders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONCURRENT_WRITERS

public static final java.lang.String CONCURRENT_WRITERS
See Also:
Constant Field Values
Constructor Detail

LuceneBatchBackend

public LuceneBatchBackend()
Method Detail

initialize

public void initialize(java.util.Properties cfg,
                       MassIndexerProgressMonitor monitor,
                       SearchFactoryImplementor searchFactoryImplementor)
Description copied from interface: BatchBackend
Used at startup, called once as first method.

Specified by:
initialize in interface BatchBackend
Parameters:
cfg - all configuration properties
searchFactoryImplementor - the client

enqueueAsyncWork

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

Specified by:
enqueueAsyncWork in interface BatchBackend
Throws:
java.lang.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

stopAndFlush

public void stopAndFlush(long timeout,
                         java.util.concurrent.TimeUnit unit)
                  throws java.lang.InterruptedException
Stops the background threads and flushes changes; Please note the timeout is applied to each index in sequence, so it might take as much time as timeout*directoryproviders

Specified by:
stopAndFlush in interface BatchBackend
Throws:
java.lang.InterruptedException - if the current thread is interrupted while waiting for the enqueued tasks to be finished.

close

public void close()
Description copied from interface: BatchBackend
Used to shutdown and release resources. No other method should be used after this one.

Specified by:
close in interface BatchBackend


Copyright © 2006-2010 Hibernate. All Rights Reserved.