Interface ConnectionWrapper


  • public interface ConnectionWrapper
    Means to obtain the Connection being wrapped.
    Author:
    Daniel Sagenschneider
    • Method Detail

      • isGetRealConnectionMethod

        static boolean isGetRealConnectionMethod​(java.lang.reflect.Method method)
        Indicates if Method is the getRealConnection().
        Parameters:
        method - Method.
        Returns:
        true if getRealConnection().
      • getRealConnection

        static java.sql.Connection getRealConnection​(java.sql.Connection connection)
                                              throws java.sql.SQLException
        Obtains the "real" Connection from the input Connection.
        Parameters:
        connection - Connection to inspect for the "real" Connection.
        Returns:
        The "real" Connection or null if none.
        Throws:
        java.sql.SQLException - If fails to obtain the "real" Connection.
      • getRealConnection

        java.sql.Connection getRealConnection()
                                       throws java.sql.SQLException

        Allows obtaining the actual Connection.

        Some implementations may Proxy the Connection to source on invocation of first Connection method. Therefore, in inspecting the Connection on recycle, it will actually acquire a Connection when none was required to be recycled (creating unnecessary Connection instances).

        This enables obtaining the "real" Connection.

        Returns:
        The "real" Connection. In some implementations it may actually be null as no "real" backing Connection is available.
        Throws:
        java.sql.SQLException - If fails to obtain the "real" Connection.