org.firebirdsql.ds

## Class XAConnectionHandler

- java.lang.Object
- - org.firebirdsql.ds.XAConnectionHandler

- All Implemented Interfaces:
    java.lang.reflect.InvocationHandler

      public class XAConnectionHandler
      extends java.lang.Object

  InvocationHandler for the logical connection returned by FBXAConnection.
  Since:
    2.2
  Author:
    Mark Rotteveel

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `CLOSED_MESSAGE`
    `protected java.sql.Connection` | `connection`
    `protected boolean` | `forcedClose`
    `protected static java.lang.String` | `FORCIBLY_CLOSED_MESSAGE`
    `protected FBPooledConnection` | `owner`
    `protected java.sql.Connection` | `proxy`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `XAConnectionHandler(java.sql.Connection connection, FBXAConnection owner)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `close()` Closes this PooledConnectionHandler.
    `protected void` | `closeStatements()`
    `protected void` | `forgetStatement(org.firebirdsql.ds.StatementHandler stmtHandler)`
    `protected java.sql.Connection` | `getProxy()`
    `protected void` | `handleClose(boolean notifyOwner)` Handle `Connection.close()` method.
    `java.lang.Object` | `invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)`
    `protected boolean` | `isClosed()`
    `protected boolean` | `isRollbackAllowed()` Method to decide if calling rollback on the physical connection for cleanup (in handleClose()) is allowed.
    `protected void` | `statementErrorOccurred(org.firebirdsql.ds.StatementHandler stmtHandler, java.sql.SQLException sqle)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CLOSED_MESSAGE

          protected static final java.lang.String CLOSED_MESSAGE

      See Also:
        Constant Field Values

    - #### FORCIBLY_CLOSED_MESSAGE

          protected static final java.lang.String FORCIBLY_CLOSED_MESSAGE

      See Also:
        Constant Field Values

    - #### owner

          protected final FBPooledConnection owner

    - #### connection

          protected volatile java.sql.Connection connection

    - #### proxy

          protected volatile java.sql.Connection proxy

    - #### forcedClose

          protected volatile boolean forcedClose

  - ### Constructor Detail

    - #### XAConnectionHandler

          protected XAConnectionHandler(java.sql.Connection connection,
                                        FBXAConnection owner)

  - ### Method Detail

    - #### isRollbackAllowed

          protected boolean isRollbackAllowed()
                                       throws java.sql.SQLException

      Method to decide if calling rollback on the physical connection for cleanup (in handleClose()) is allowed.

      NOTE: This method is not involved in rollback decisions for calls to the proxy.

      Returns:
        `true` when calling rollback is allowed
      Throws:
        `java.sql.SQLException`

    - #### invoke

          public java.lang.Object invoke(java.lang.Object proxy,
                                         java.lang.reflect.Method method,
                                         java.lang.Object[] args)
                                  throws java.lang.Throwable

      Specified by:
        `invoke` in interface `java.lang.reflect.InvocationHandler`
      Throws:
        `java.lang.Throwable`

    - #### handleClose

          protected void handleClose(boolean notifyOwner)
                              throws java.sql.SQLException

      Handle `Connection.close()` method. This implementation closes the connection and associated statements.
      Parameters:
        `notifyOwner` - `true` when connection owner should be notified of closure.
      Throws:
        `java.sql.SQLException` - if underlying connection threw an exception.

    - #### getProxy

          protected java.sql.Connection getProxy()

      Returns:
        Proxy for the Connection object

    - #### close

          protected void close()
                        throws java.sql.SQLException

      Closes this PooledConnectionHandler. Intended to be called by the ConnectionPoolDataSource when it wants to forcibly close the logical connection to reuse it.
      Throws:
        `java.sql.SQLException`

    - #### isClosed

          protected boolean isClosed()

    - #### statementErrorOccurred

          protected void statementErrorOccurred(org.firebirdsql.ds.StatementHandler stmtHandler,
                                                java.sql.SQLException sqle)

    - #### forgetStatement

          protected void forgetStatement(org.firebirdsql.ds.StatementHandler stmtHandler)

    - #### closeStatements

          protected void closeStatements()
                                  throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.