Package org.mariadb.jdbc
Class MariaDbPoolConnection
- java.lang.Object
-
- org.mariadb.jdbc.MariaDbPoolConnection
-
- All Implemented Interfaces:
javax.sql.PooledConnection,javax.sql.XAConnection
- Direct Known Subclasses:
MariaDbInnerPoolConnection,MariaDbPoolPinnedConnection
public class MariaDbPoolConnection extends java.lang.Object implements javax.sql.PooledConnection, javax.sql.XAConnectionMariaDB pool connection implementation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classMariaDbPoolConnection.MariaDbXAResource
-
Field Summary
Fields Modifier and Type Field Description private Connectionconnectionprivate java.util.List<javax.sql.ConnectionEventListener>connectionEventListenersprivate java.util.List<javax.sql.StatementEventListener>statementEventListeners
-
Constructor Summary
Constructors Constructor Description MariaDbPoolConnection(Connection connection)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionEventListener(javax.sql.ConnectionEventListener listener)voidaddStatementEventListener(javax.sql.StatementEventListener listener)voidclose()Close underlying connectionvoidfireConnectionClosed(javax.sql.ConnectionEvent event)Fire connection close event to registered listeners.voidfireConnectionErrorOccurred(java.sql.SQLException returnEx)Fire connection error event to registered listeners.voidfireStatementClosed(java.sql.PreparedStatement statement)Fire statement close event to registered listeners.voidfireStatementErrorOccurred(java.sql.PreparedStatement statement, java.sql.SQLException returnEx)Fire statement error event to registered listeners.protected static java.lang.StringflagsToString(int flags)ConnectiongetConnection()javax.transaction.xa.XAResourcegetXAResource()protected static javax.transaction.xa.XAExceptionmapXaException(java.sql.SQLException sqle)protected voidrealClose()voidremoveConnectionEventListener(javax.sql.ConnectionEventListener listener)voidremoveStatementEventListener(javax.sql.StatementEventListener listener)static java.lang.StringxidToString(javax.transaction.xa.Xid xid)Create XID string
-
-
-
Field Detail
-
connection
private final Connection connection
-
connectionEventListeners
private final java.util.List<javax.sql.ConnectionEventListener> connectionEventListeners
-
statementEventListeners
private final java.util.List<javax.sql.StatementEventListener> statementEventListeners
-
-
Constructor Detail
-
MariaDbPoolConnection
public MariaDbPoolConnection(Connection connection)
Constructor.- Parameters:
connection- connection to retrieve connection options
-
-
Method Detail
-
xidToString
public static java.lang.String xidToString(javax.transaction.xa.Xid xid)
Create XID string- Parameters:
xid- xid value- Returns:
- XID string
-
getConnection
public Connection getConnection()
- Specified by:
getConnectionin interfacejavax.sql.PooledConnection
-
addConnectionEventListener
public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
addConnectionEventListenerin interfacejavax.sql.PooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
removeConnectionEventListenerin interfacejavax.sql.PooledConnection
-
addStatementEventListener
public void addStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
addStatementEventListenerin interfacejavax.sql.PooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
removeStatementEventListenerin interfacejavax.sql.PooledConnection
-
fireStatementClosed
public void fireStatementClosed(java.sql.PreparedStatement statement)
Fire statement close event to registered listeners.- Parameters:
statement- closing statement
-
fireStatementErrorOccurred
public void fireStatementErrorOccurred(java.sql.PreparedStatement statement, java.sql.SQLException returnEx)Fire statement error event to registered listeners.- Parameters:
statement- closing statementreturnEx- exception
-
fireConnectionClosed
public void fireConnectionClosed(javax.sql.ConnectionEvent event)
Fire connection close event to registered listeners.- Parameters:
event- close connection event
-
fireConnectionErrorOccurred
public void fireConnectionErrorOccurred(java.sql.SQLException returnEx)
Fire connection error event to registered listeners.- Parameters:
returnEx- exception
-
close
public void close() throws java.sql.SQLExceptionClose underlying connection- Specified by:
closein interfacejavax.sql.PooledConnection- Throws:
java.sql.SQLException- if close fails
-
realClose
protected void realClose() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getXAResource
public javax.transaction.xa.XAResource getXAResource()
- Specified by:
getXAResourcein interfacejavax.sql.XAConnection
-
mapXaException
protected static javax.transaction.xa.XAException mapXaException(java.sql.SQLException sqle)
-
flagsToString
protected static java.lang.String flagsToString(int flags)
-
-