Class ConnectionHandler

java.lang.Object
io.agroal.pool.ConnectionHandler
All Implemented Interfaces:
io.agroal.api.cache.Acquirable, io.agroal.api.transaction.TransactionAware

public final class ConnectionHandler extends Object implements io.agroal.api.transaction.TransactionAware, io.agroal.api.cache.Acquirable
Author:
Luis Barreiro
  • Constructor Details

  • Method Details

    • xaConnectionWrapper

      public XAConnectionWrapper xaConnectionWrapper()
    • connectionWrapper

      public ConnectionWrapper connectionWrapper()
    • detachedWrapper

      public ConnectionWrapper detachedWrapper()
    • onConnectionWrapperClose

      public void onConnectionWrapperClose(ConnectionWrapper wrapper, ConnectionWrapper.JdbcResourcesLeakReport leakReport) throws SQLException
      Throws:
      SQLException
    • rawConnection

      public Connection rawConnection()
    • getXaResource

      public XAResource getXaResource()
    • resetConnection

      public void resetConnection() throws SQLException
      Throws:
      SQLException
    • closeConnection

      public void closeConnection() throws SQLException
      Throws:
      SQLException
    • acquire

      public boolean acquire()
      Specified by:
      acquire in interface io.agroal.api.cache.Acquirable
    • isAcquirable

      public boolean isAcquirable()
      Specified by:
      isAcquirable in interface io.agroal.api.cache.Acquirable
    • setState

      public boolean setState(ConnectionHandler.State expected, ConnectionHandler.State newState)
    • setState

      public void setState(ConnectionHandler.State newState)
    • touch

      public void touch()
    • isLeak

      public boolean isLeak(Duration timeout)
    • isIdle

      public boolean isIdle(Duration timeout)
    • setMaxLifetimeTask

      public void setMaxLifetimeTask(Future<?> maxLifetimeTask)
    • isValid

      public boolean isValid()
    • verifyReadOnly

      public void verifyReadOnly(boolean readOnly) throws SQLException
      Throws:
      SQLException
    • getHoldingThread

      public Thread getHoldingThread()
    • setHoldingThread

      public void setHoldingThread(Thread holdingThread)
    • traceConnectionOperation

      public void traceConnectionOperation(String operation)
      Abbreviated list of all operation on the connection, for enhanced leak report
    • getConnectionOperations

      public List<String> getConnectionOperations()
      Abbreviated list of all operation on the connection, for enhanced leak report
    • getAcquisitionStackTrace

      public StackTraceElement[] getAcquisitionStackTrace()
      Stack trace of the first acquisition for this connection
    • setAcquisitionStackTrace

      public void setAcquisitionStackTrace(StackTraceElement[] stackTrace)
      Stores a stack trace for leak report. Setting a value != null also enables tracing of operations on the connection
    • getLastOperationStackTrace

      public StackTraceElement[] getLastOperationStackTrace()
      Stack trace for the last operation on this connection
    • setDirtyAttribute

      public void setDirtyAttribute(ConnectionHandler.DirtyAttribute attribute)
    • isEnlisted

      public boolean isEnlisted()
    • getConnection

      public Connection getConnection()
      Specified by:
      getConnection in interface io.agroal.api.transaction.TransactionAware
    • transactionStart

      public void transactionStart() throws SQLException
      Specified by:
      transactionStart in interface io.agroal.api.transaction.TransactionAware
      Throws:
      SQLException
    • transactionBeforeCompletion

      public void transactionBeforeCompletion(boolean successful)
      Specified by:
      transactionBeforeCompletion in interface io.agroal.api.transaction.TransactionAware
    • transactionCommit

      public void transactionCommit() throws SQLException
      Specified by:
      transactionCommit in interface io.agroal.api.transaction.TransactionAware
      Throws:
      SQLException
    • transactionRollback

      public void transactionRollback() throws SQLException
      Specified by:
      transactionRollback in interface io.agroal.api.transaction.TransactionAware
      Throws:
      SQLException
    • transactionEnd

      public void transactionEnd() throws SQLException
      Specified by:
      transactionEnd in interface io.agroal.api.transaction.TransactionAware
      Throws:
      SQLException
    • transactionCheckCallback

      public void transactionCheckCallback(io.agroal.api.transaction.TransactionAware.SQLCallable<Boolean> transactionCheck)
      Specified by:
      transactionCheckCallback in interface io.agroal.api.transaction.TransactionAware
    • verifyEnlistment

      public void verifyEnlistment() throws SQLException
      Throws:
      SQLException
    • setFlushOnly

      public void setFlushOnly()
      Specified by:
      setFlushOnly in interface io.agroal.api.transaction.TransactionAware
    • setFlushOnly

      public void setFlushOnly(SQLException se)