Interface FailureHandler


public interface FailureHandler
A handler for failures occurring during background operations, which may not have been reported to the caller due to being executed asynchronously.

The handler should be used to report failures to application maintainers. The default failure handler simply logs failures at the ERROR level, but it can be replaced with a custom implementations through a configuration property.

Handlers can be called from multiple threads simultaneously: implementations must be thread-safe.

Author:
Amin Mohammed-Coleman
  • Method Summary

    Modifier and Type
    Method
    Description
    default long
    When this handler is used for handling mass indexing failures - returns the number of failures during one mass indexing beyond which the failure handler will no longer be notified.
    void
    Handle the failure of entity indexing.
    void
    Handle a generic failure.
  • Method Details

    • handle

      void handle(FailureContext context)
      Handle a generic failure.

      This method is expected to report the failure somewhere (logs, ...), then return as quickly as possible. Heavy error processing (sending emails, ...), if any, should be done asynchronously.

      Any error or exception thrown by this method will be caught by Hibernate Search and logged.

      Parameters:
      context - Contextual information about the failure (throwable, operation, ...)
    • handle

      void handle(EntityIndexingFailureContext context)
      Handle the failure of entity indexing.

      This method is expected to report the failure somewhere (logs, ...), then return as quickly as possible. Heavy error processing (sending emails, ...), if any, should be done asynchronously.

      Any error or exception thrown by this method will be caught by Hibernate Search and logged.

      Parameters:
      context - Contextual information about the failure (throwable, operation, ...)
    • failureFloodingThreshold

      @Incubating default long failureFloodingThreshold()
      When this handler is used for handling mass indexing failures - returns the number of failures during one mass indexing beyond which the failure handler will no longer be notified. This threshold is reached separately for each indexed type. Otherwise, i.e. not in the context of mass indexing, this value is ignored.

      May be overridden by mass indexer parameters (see failureFloodingThreshold(long) in the MassIndexer interface).