Interface DbInterceptor

  • All Known Implementing Classes:
    DbClientTracing, DbCounter, DbMeter, DbTimer
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface DbInterceptor
    Interceptor to handle work around a database statement. Example of such interceptors: tracing, metrics.

    Interceptors can be defined as global interceptors, interceptors for a type of a statement and interceptors for a named statement. These are executed in the following order:

    1. Named interceptors - if there are any interceptors configured for a specific statement, they are executed first
    2. Type interceptors - if there are any interceptors configured for a type of statement, they are executed next
    3. Global interceptors - if there are any interceptors configured globally, they are executed last
    Order of interceptors within a group is based on the order they are registered in a builder, or by their priority when loaded from a Java Service loader
    • Method Detail

      • statement

        CompletionStage<DbInterceptorContext> statement​(DbInterceptorContext context)
        Statement execution to be intercepted. This method is called before the statement execution starts.
        Parameters:
        context - Context to access data needed to process an interceptor
        Returns:
        completion stage that completes when this interceptor is finished