org.jboss.jca.adapters.jdbc

## Class BaseWrapperManagedConnection

- java.lang.Object
- - org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection

- All Implemented Interfaces:
    javax.resource.spi.ManagedConnection, org.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection, org.jboss.jca.core.spi.transaction.ConnectableResource
  Direct Known Subclasses:
    LocalManagedConnection, XAManagedConnection

      public abstract class BaseWrapperManagedConnection
      extends java.lang.Object
      implements org.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection, org.jboss.jca.core.spi.transaction.ConnectableResource

  BaseWrapperManagedConnection
  Author:
    David Jencks, Adrian Brock, Weston Price, Jesper Pedersen

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.jboss.jca.adapters.AdaptersBundle` | `bundle` The bundle
    `protected java.sql.Connection` | `con` The connection
    `protected boolean` | `destroyed` Destroyed
    `protected static boolean` | `ignoreInManagedAutoCommitCalls` Ignore in managed auto commit calls
    `protected java.util.concurrent.atomic.AtomicBoolean` | `inLocalTransaction` Is inside a local transaction
    `protected boolean` | `inManagedTransaction` Is inside a managed transaction
    `protected boolean` | `jdbcAutoCommit` JDBC auto-commit
    `protected boolean` | `jdbcReadOnly` JDBC read-only
    `protected int` | `jdbcTransactionIsolation` JDBC transaction isolation
    `protected BaseWrapperManagedConnectionFactory` | `mcf` The managed connection factory
    `protected javax.resource.spi.ManagedConnectionMetaData` | `metadata` Metadata
    `protected java.util.Properties` | `props` The properties
    `protected java.lang.Object` | `stateLock` The state lock
    `protected boolean` | `underlyingAutoCommit` Underlying auto-commit
    `protected boolean` | `underlyingReadOnly` Underlying read-only

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseWrapperManagedConnection(BaseWrapperManagedConnectionFactory mcf, java.sql.Connection con, java.util.Properties props, int transactionIsolation, int psCacheSize)` Constructor

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)` Add a connection event listener
    `void` | `associateConnection(java.lang.Object handle)` Associate a handle
    `protected void` | `broadcastConnectionError(java.lang.Throwable e)` Broad cast a connection error
    `protected void` | `checkException(java.sql.SQLException e)` Check exception
    `protected void` | `checkState()` Check state
    `void` | `cleanup()`
    `void` | `destroy()` Destroy
    `protected java.util.Optional<java.lang.invoke.MethodHandle>` | `getBeginRequestNotify()`
    `java.lang.Object` | `getConnection()`
    `java.lang.Object` | `getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)` Get a connection
    `protected java.util.Optional<java.lang.invoke.MethodHandle>` | `getEndRequestNotify()`
    `protected org.jboss.jca.adapters.AdaptersLogger` | `getLog()` Get the logger
    `java.io.PrintWriter` | `getLogWriter()`
    `javax.resource.spi.ManagedConnectionMetaData` | `getMetaData()`
    `java.util.Properties` | `getProperties()` Get the properties
    `abstract boolean` | `isXA()` Returns true if the underlying connection is handled by an XA resource manager
    `protected void` | `lock()` Lock
    `void` | `notifyRequestBegin()`
    `void` | `notifyRequestEnd()`
    `void` | `removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)` Remove a connection event listener
    `protected void` | `setBeginRequestNotify(java.util.Optional<java.lang.invoke.MethodHandle> beginRequest)`
    `void` | `setConnectableResourceListener(org.jboss.jca.core.spi.transaction.ConnectableResourceListener crl)`
    `protected void` | `setEndRequestNotify(java.util.Optional<java.lang.invoke.MethodHandle> endRequest)`
    `void` | `setLogWriter(java.io.PrintWriter param1)`
    `protected void` | `tryLock()` Try lock
    `protected void` | `unlock()` Unlock

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

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

    - ### Methods inherited from interface javax.resource.spi.ManagedConnection

      `getLocalTransaction, getXAResource`

- - ### Field Detail

    - #### bundle

          protected static org.jboss.jca.adapters.AdaptersBundle bundle

      The bundle

    - #### mcf

          protected final BaseWrapperManagedConnectionFactory mcf

      The managed connection factory

    - #### con

          protected final java.sql.Connection con

      The connection

    - #### props

          protected java.util.Properties props

      The properties

    - #### stateLock

          protected final java.lang.Object stateLock

      The state lock

    - #### inManagedTransaction

          protected boolean inManagedTransaction

      Is inside a managed transaction

    - #### inLocalTransaction

          protected java.util.concurrent.atomic.AtomicBoolean inLocalTransaction

      Is inside a local transaction

    - #### jdbcAutoCommit

          protected boolean jdbcAutoCommit

      JDBC auto-commit

    - #### ignoreInManagedAutoCommitCalls

          protected static boolean ignoreInManagedAutoCommitCalls

      Ignore in managed auto commit calls

    - #### underlyingAutoCommit

          protected boolean underlyingAutoCommit

      Underlying auto-commit

    - #### jdbcReadOnly

          protected boolean jdbcReadOnly

      JDBC read-only

    - #### underlyingReadOnly

          protected boolean underlyingReadOnly

      Underlying read-only

    - #### jdbcTransactionIsolation

          protected int jdbcTransactionIsolation

      JDBC transaction isolation

    - #### destroyed

          protected boolean destroyed

      Destroyed

    - #### metadata

          protected javax.resource.spi.ManagedConnectionMetaData metadata

      Metadata

  - ### Constructor Detail

    - #### BaseWrapperManagedConnection

          public BaseWrapperManagedConnection(BaseWrapperManagedConnectionFactory mcf,
                                              java.sql.Connection con,
                                              java.util.Properties props,
                                              int transactionIsolation,
                                              int psCacheSize)
                                       throws java.sql.SQLException

      Constructor
      Parameters:
        `mcf` - The managed connection factory
        `con` - The connection
        `props` - The properties
        `transactionIsolation` - The transaction isolation
        `psCacheSize` - The prepared statement cache size
      Throws:
        `java.sql.SQLException` - Thrown if an error occurs

  - ### Method Detail

    - #### addConnectionEventListener

          public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)

      Add a connection event listener
      Specified by:
        `addConnectionEventListener` in interface `javax.resource.spi.ManagedConnection`
      Parameters:
        `cel` - The listener

    - #### removeConnectionEventListener

          public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)

      Remove a connection event listener
      Specified by:
        `removeConnectionEventListener` in interface `javax.resource.spi.ManagedConnection`
      Parameters:
        `cel` - The listener

    - #### associateConnection

          public void associateConnection(java.lang.Object handle)
                                   throws javax.resource.ResourceException

      Associate a handle
      Specified by:
        `associateConnection` in interface `javax.resource.spi.ManagedConnection`
      Parameters:
        `handle` - The handle
      Throws:
        `javax.resource.ResourceException` - Thrown if an error occurs

    - #### getLogWriter

          public java.io.PrintWriter getLogWriter()
                                           throws javax.resource.ResourceException

      Specified by:
        `getLogWriter` in interface `javax.resource.spi.ManagedConnection`
      Throws:
        `javax.resource.ResourceException`

    - #### getMetaData

          public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                                   throws javax.resource.ResourceException

      Specified by:
        `getMetaData` in interface `javax.resource.spi.ManagedConnection`
      Throws:
        `javax.resource.ResourceException`

    - #### setLogWriter

          public void setLogWriter(java.io.PrintWriter param1)
                            throws javax.resource.ResourceException

      Specified by:
        `setLogWriter` in interface `javax.resource.spi.ManagedConnection`
      Throws:
        `javax.resource.ResourceException`

    - #### cleanup

          public void cleanup()
                       throws javax.resource.ResourceException

      Specified by:
        `cleanup` in interface `javax.resource.spi.ManagedConnection`
      Throws:
        `javax.resource.ResourceException`

    - #### lock

          protected void lock()

      Lock

    - #### tryLock

          protected void tryLock()
                          throws java.sql.SQLException

      Try lock
      Throws:
        `java.sql.SQLException` - Thrown if a lock can't be obtained

    - #### unlock

          protected void unlock()

      Unlock

    - #### getConnection

          public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                                javax.resource.spi.ConnectionRequestInfo cri)
                                         throws javax.resource.ResourceException

      Get a connection
      Specified by:
        `getConnection` in interface `javax.resource.spi.ManagedConnection`
      Parameters:
        `subject` - The subject
        `cri` - The connection request info
      Returns:
        The connection
      Throws:
        `javax.resource.ResourceException` - Thrown if an error occurs

    - #### destroy

          public void destroy()
                       throws javax.resource.ResourceException

      Destroy
      Specified by:
        `destroy` in interface `javax.resource.spi.ManagedConnection`
      Throws:
        `javax.resource.ResourceException` - Thrown if an error occurs

    - #### getProperties

          public java.util.Properties getProperties()

      Get the properties
      Returns:
        The value

    - #### getConnection

          public java.lang.Object getConnection()
                                         throws java.lang.Exception

      Specified by:
        `getConnection` in interface `org.jboss.jca.core.spi.transaction.ConnectableResource`
      Throws:
        `java.lang.Exception`

    - #### setConnectableResourceListener

          public void setConnectableResourceListener(org.jboss.jca.core.spi.transaction.ConnectableResourceListener crl)

      Specified by:
        `setConnectableResourceListener` in interface `org.jboss.jca.core.spi.transaction.ConnectableResource`

    - #### broadcastConnectionError

          protected void broadcastConnectionError(java.lang.Throwable e)

      Broad cast a connection error
      Parameters:
        `e` - The error

    - #### getLog

          protected org.jboss.jca.adapters.AdaptersLogger getLog()

      Get the logger
      Returns:
        The value

    - #### checkState

          protected void checkState()
                             throws java.sql.SQLException

      Check state
      Throws:
        `java.sql.SQLException` - Thrown if an error occurs

    - #### checkException

          protected void checkException(java.sql.SQLException e)
                                 throws javax.resource.ResourceException

      Check exception
      Parameters:
        `e` - The exception
      Throws:
        `javax.resource.ResourceException` - Thrown if an error occurs

    - #### getEndRequestNotify

          protected java.util.Optional<java.lang.invoke.MethodHandle> getEndRequestNotify()

    - #### setEndRequestNotify

          protected void setEndRequestNotify(java.util.Optional<java.lang.invoke.MethodHandle> endRequest)

    - #### getBeginRequestNotify

          protected java.util.Optional<java.lang.invoke.MethodHandle> getBeginRequestNotify()

    - #### setBeginRequestNotify

          protected void setBeginRequestNotify(java.util.Optional<java.lang.invoke.MethodHandle> beginRequest)

    - #### isXA

          public abstract boolean isXA()

      Returns true if the underlying connection is handled by an XA resource manager
      Returns:
        The value

    - #### notifyRequestBegin

          public void notifyRequestBegin()

      Specified by:
        `notifyRequestBegin` in interface `org.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection`

    - #### notifyRequestEnd

          public void notifyRequestEnd()

      Specified by:
        `notifyRequestEnd` in interface `org.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection`

Copyright © 2014 IronJacamar (http://www.ironjacamar.org)