Class LuceneBatchBackend

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

public class LuceneBatchBackend 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.
  • Field Details

  • Constructor Details

    • LuceneBatchBackend

      public LuceneBatchBackend()
  • Method Details

    • initialize

      public void initialize(Properties cfg, MassIndexerProgressMonitor monitor, WorkerBuildContext context)
      Description copied from interface: BatchBackend
      Used at startup, called once as first method.
      Specified by:
      initialize in interface BatchBackend
      Parameters:
      cfg - all configuration properties
      monitor - the indexing progress monitor
      context - the build context for the workers
    • 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
      Parameters:
      work -
      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
      Parameters:
      work -
    • stopAndFlush

      public void stopAndFlush(long timeout, TimeUnit unit) throws 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:
      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