Interface MassIndexingMonitor


public interface MassIndexingMonitor
A component that monitors progress of mass indexing.

As a MassIndexer can take some time to finish its job, it is often necessary to monitor its progress. The default, built-in monitor logs progress periodically at the INFO level.

Implementations must be threadsafe.

Author:
Sanne Grinovero, Hardy Ferentschik
  • Method Details

    • typeGroupMonitor

      Creates a type-group-specific monitor.

      The mass indexer may group some of the types it has to index or index them separately. The type group represents this combination of types that are retrieved for indexing in the same pipeline.

      The mass indexer will request to create a type group monitor in the main indexing thread when initializing the mass indexing environment.

      Parameters:
      context - Describes the type group for which the monitor is requested.
      Returns:
      A type group mass indexing monitor. By default, a no-op monitor is returned.
      See Also:
    • documentsAdded

      void documentsAdded(long increment)
      Notify the monitor that increment more documents have been added to the index.

      Summing the numbers passed to this method gives the total number of documents that have been added to the index so far.

      This method is invoked several times during indexing, and calls are incremental: calling documentsAdded(3) and then documentsAdded(1) should be understood as "3+1 documents, i.e. 4 documents have been added to the index".

      This method can be invoked from several threads thus implementors are required to be thread-safe.

      Parameters:
      increment - additional number of documents built
    • documentsBuilt

      void documentsBuilt(long increment)
      Notify the monitor that increment more documents have been built.

      Summing the numbers passed to this method gives the total number of documents that have been built so far.

      This method is invoked several times during indexing, and calls are incremental: calling documentsBuilt(3) and then documentsBuilt(1) should be understood as "3+1 documents, i.e. 4 documents have been built".

      This method can be invoked from several threads thus implementors are required to be thread-safe.

      Parameters:
      increment - additional number of documents built
    • entitiesLoaded

      void entitiesLoaded(long increment)
      Notify the monitor that increment more entities have been loaded from the database.

      Summing the numbers passed to this method gives the total number of entities that have been loaded so far.

      This method is invoked several times during indexing, and calls are incremental: calling entitiesLoaded(3) and then entitiesLoaded(1) should be understood as "3+1 documents, i.e. 4 documents have been loaded".

      This method can be invoked from several threads thus implementors are required to be thread-safe.

      Parameters:
      increment - additional number of entities loaded from database
    • addToTotalCount

      @Deprecated(forRemoval=true, since="8.0") default void addToTotalCount(long increment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use MassIndexingTypeGroupMonitor.indexingStarted(MassIndexingTypeGroupMonitorContext) and get the total count, if available, from the MassIndexingTypeGroupMonitorContext.totalCount(). Alternatively, use the typeGroupMonitor(MassIndexingTypeGroupMonitorCreateContext) and obtain the count from MassIndexingTypeGroupMonitorCreateContext.totalCount() if a count is needed before any indexing processes are started.
      Notify the monitor that increment more entities have been detected in the database and will be indexed.

      Summing the numbers passed to this method gives the total number of entities that Hibernate Search plans to index. This number can be incremented during indexing as Hibernate Search moves from one entity type to the next.

      This method is invoked several times during indexing, and calls are incremental: calling addToTotalCount(3) and then addToTotalCount(1) should be understood as "3+1 documents, i.e. 4 documents will be indexed".

      This method can be invoked from several threads thus implementors are required to be thread-safe.

      Parameters:
      increment - additional number of entities that will be indexed
    • indexingCompleted

      void indexingCompleted()
      Notify the monitor that indexing is complete.