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, ConnectableResource
Direct Known Subclasses:
LocalManagedConnection, XAManagedConnection

public abstract class BaseWrapperManagedConnection extends Object implements org.jboss.jca.core.connectionmanager.pool.mcp.NotifyingManagedConnection, ConnectableResource
BaseWrapperManagedConnection
Author:
David Jencks, Adrian Brock, Weston Price, Jesper Pedersen
  • Field Details

    • bundle

      protected static AdaptersBundle bundle
      The bundle
    • mcf

      The managed connection factory
    • con

      protected final Connection con
      The connection
    • props

      protected Properties props
      The properties
    • stateLock

      protected final Object stateLock
      The state lock
    • inManagedTransaction

      protected boolean inManagedTransaction
      Is inside a managed transaction
    • inLocalTransaction

      protected 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
    • setAutoCommitOnCleanup

      protected static boolean setAutoCommitOnCleanup
    • 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 Details

    • BaseWrapperManagedConnection

      public BaseWrapperManagedConnection(BaseWrapperManagedConnectionFactory mcf, Connection con, Properties props, int transactionIsolation, int psCacheSize) throws 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:
      SQLException - Thrown if an error occurs
  • Method Details

    • 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(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 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(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 SQLException
      Try lock
      Throws:
      SQLException - Thrown if a lock can't be obtained
    • unlock

      protected void unlock()
      Unlock
    • getConnection

      public Object getConnection(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 Properties getProperties()
      Get the properties
      Returns:
      The value
    • getConnection

      public Object getConnection() throws Exception
      Specified by:
      getConnection in interface ConnectableResource
      Throws:
      Exception
    • setConnectableResourceListener

      public void setConnectableResourceListener(ConnectableResourceListener crl)
      Specified by:
      setConnectableResourceListener in interface ConnectableResource
    • broadcastConnectionError

      protected void broadcastConnectionError(Throwable e)
      Broad cast a connection error
      Parameters:
      e - The error
    • getLog

      protected AdaptersLogger getLog()
      Get the logger
      Returns:
      The value
    • checkState

      protected void checkState() throws SQLException
      Check state
      Throws:
      SQLException - Thrown if an error occurs
    • checkException

      protected void checkException(SQLException e) throws javax.resource.ResourceException
      Check exception
      Parameters:
      e - The exception
      Throws:
      javax.resource.ResourceException - Thrown if an error occurs
    • getEndRequestNotify

      protected Optional<MethodHandle> getEndRequestNotify()
    • setEndRequestNotify

      protected void setEndRequestNotify(Optional<MethodHandle> endRequest)
    • getBeginRequestNotify

      protected Optional<MethodHandle> getBeginRequestNotify()
    • setBeginRequestNotify

      protected void setBeginRequestNotify(Optional<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