org.hibernate.search.backend.impl.batch

## Class DefaultBatchBackend

- java.lang.Object
- - 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

    Constructors
    Constructor and Description
    `DefaultBatchBackend(ExtendedSearchIntegrator integrator, MassIndexerProgressMonitor progressMonitor)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `awaitAsyncProcessingCompletion()` Blocks until all the previously submitted work via `BatchBackend.enqueueAsyncWork(LuceneWork)` are applied to the index.
    `void` | `doWorkInSync(LuceneWork work)` Does one work in sync
    `void` | `enqueueAsyncWork(LuceneWork work)` Enqueues one work to be processed asynchronously
    `void` | `flush(IndexedTypeSet 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(IndexedTypeSet 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(ExtendedSearchIntegrator integrator,
                                     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`
      Parameters:
        `work` - a `LuceneWork` object.
      Throws:
        `InterruptedException` - if the current thread is interrupted while waiting for the work queue to have enough space.

    - #### awaitAsyncProcessingCompletion

          public void awaitAsyncProcessingCompletion()

      Description copied from interface: `BatchBackend`
      Blocks until all the previously submitted work via `BatchBackend.enqueueAsyncWork(LuceneWork)` are applied to the index.
      Specified by:
        `awaitAsyncProcessingCompletion` in interface `BatchBackend`

    - #### doWorkInSync

          public void doWorkInSync(LuceneWork work)

      Description copied from interface: `BatchBackend`
      Does one work in sync
      Specified by:
        `doWorkInSync` in interface `BatchBackend`
      Parameters:
        `work` - the lucene work to execute

    - #### flush

          public void flush(IndexedTypeSet 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`
      Parameters:
        `entityTypes` - a `Set` object.

    - #### optimize

          public void optimize(IndexedTypeSet 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-2017 Red Hat, Inc. All Rights Reserved