Package io.agroal.pool
Class ConnectionHandler
- java.lang.Object
-
- io.agroal.pool.ConnectionHandler
-
- All Implemented Interfaces:
TransactionAware
public final class ConnectionHandler extends Object implements TransactionAware
- Author:
- Luis Barreiro
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConnectionHandler.DirtyAttributestatic classConnectionHandler.State-
Nested classes/interfaces inherited from interface io.agroal.api.transaction.TransactionAware
TransactionAware.SQLCallable<T extends Object>
-
-
Constructor Summary
Constructors Constructor Description ConnectionHandler(XAConnection xaConnection, Pool pool)
-
Method Summary
-
-
-
Constructor Detail
-
ConnectionHandler
public ConnectionHandler(XAConnection xaConnection, Pool pool) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
newConnectionWrapper
public ConnectionWrapper newConnectionWrapper()
-
newDetachedConnectionWrapper
public ConnectionWrapper newDetachedConnectionWrapper()
-
onConnectionWrapperClose
public void onConnectionWrapperClose(ConnectionWrapper wrapper, ConnectionWrapper.JdbcResourcesLeakReport leakReport) throws SQLException
- Throws:
SQLException
-
getConnection
public Connection getConnection()
- Specified by:
getConnectionin interfaceTransactionAware
-
getXaResource
public XAResource getXaResource()
-
resetConnection
public void resetConnection() throws SQLException- Throws:
SQLException
-
closeConnection
public void closeConnection() throws SQLException- Throws:
SQLException
-
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)
-
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()
-
transactionStart
public void transactionStart() throws SQLException- Specified by:
transactionStartin interfaceTransactionAware- Throws:
SQLException
-
transactionCommit
public void transactionCommit() throws SQLException- Specified by:
transactionCommitin interfaceTransactionAware- Throws:
SQLException
-
transactionRollback
public void transactionRollback() throws SQLException- Specified by:
transactionRollbackin interfaceTransactionAware- Throws:
SQLException
-
transactionEnd
public void transactionEnd() throws SQLException- Specified by:
transactionEndin interfaceTransactionAware- Throws:
SQLException
-
transactionCheckCallback
public void transactionCheckCallback(TransactionAware.SQLCallable<Boolean> transactionCheck)
- Specified by:
transactionCheckCallbackin interfaceTransactionAware
-
verifyEnlistment
public void verifyEnlistment() throws SQLException- Throws:
SQLException
-
setFlushOnly
public void setFlushOnly()
- Specified by:
setFlushOnlyin interfaceTransactionAware
-
setFlushOnly
public void setFlushOnly(SQLException se)
-
-