Class ConnectionWrapperFactory

java.lang.Object
org.axonframework.common.jdbc.ConnectionWrapperFactory

public abstract class ConnectionWrapperFactory extends Object
Factory for creating wrappers around a Connection, allowing one to override the behavior of the Connection.close() method.
Since:
2.2
Author:
Allard Buijze
  • Method Details

    • wrap

      public static <I> Connection wrap(Connection connection, Class<I> wrapperInterface, I wrapperHandler, ConnectionWrapperFactory.ConnectionCloseHandler closeHandler)
      Wrap the given connection, creating a Proxy with an additional wrapperInterface (implemented by given wrapperHandler). Calls to the close method are forwarded to the given closeHandler.

      Note that all invocations on methods declared on the wrapperInterface (including equals, hashCode) are forwarded to the wrapperHandler.

      Type Parameters:
      I - The type of additional interface for the wrapper to implement
      Parameters:
      connection - The connection to wrap
      wrapperInterface - The additional interface to implement
      wrapperHandler - The implementation for the additional interface
      closeHandler - The handler to redirect close invocations to
      Returns:
      a wrapped Connection
    • wrap

      public static Connection wrap(Connection connection, ConnectionWrapperFactory.ConnectionCloseHandler closeHandler)
      Wrap the given connection, creating a Proxy with an additional wrapperInterface (implemented by given wrapperHandler). Calls to the close method are forwarded to the given closeHandler.
      Parameters:
      connection - The connection to wrap
      closeHandler - The handler to redirect close invocations to
      Returns:
      a wrapped Connection