| Modifier and Type | Method and Description |
|---|---|
static ConnectionInformation |
fromDataSource(javax.sql.CommonDataSource dataSource)
Creates a new
ConnectionInformation instance for a Connection which will be obtained via a
CommonDataSource |
static ConnectionInformation |
fromDataSource(javax.sql.CommonDataSource dataSource,
java.sql.Connection connection,
long timeToGetConnectionNs)
Creates a new
ConnectionInformation instance for a Connection which has been obtained via a
CommonDataSource |
static ConnectionInformation |
fromDriver(java.sql.Driver driver)
|
static ConnectionInformation |
fromDriver(java.sql.Driver driver,
java.sql.Connection connection,
long timeToGetConnectionNs)
|
static ConnectionInformation |
fromPooledConnection(javax.sql.PooledConnection pooledConnection)
Creates a new
ConnectionInformation instance for a Connection which will be obtained via a
PooledConnection |
static ConnectionInformation |
fromPooledConnection(javax.sql.PooledConnection pooledConnection,
java.sql.Connection connection,
long timeToGetConnectionNs)
Creates a new
ConnectionInformation instance for a Connection which has been obtained via a
PooledConnection |
static ConnectionInformation |
fromTestConnection(java.sql.Connection connection)
This method should only be used in test scenarios
|
java.sql.Connection |
getConnection()
Returns a reference to the
Connection |
int |
getConnectionId() |
ConnectionInformation |
getConnectionInformation() |
javax.sql.CommonDataSource |
getDataSource()
Returns the
dataSource which created the connection
or null if it wasn't created via a CommonDataSource. |
java.sql.Driver |
getDriver()
|
javax.sql.PooledConnection |
getPooledConnection()
Returns the
pooledConnection which created the connection
or null if it wasn't created via a PooledConnection. |
java.lang.String |
getSql() |
java.lang.String |
getSqlWithValues() |
long |
getTimeToCloseConnectionNs()
Returns the time it took to close the connection in nanoseconds
|
long |
getTimeToGetConnectionNs()
Returns the time it took to obtain the connection in nanoseconds
|
java.lang.String |
getUrl()
If the connection was created by calling
Driver.connect(String, Properties),
returns the url which was used to create the connection. |
void |
setConnection(java.sql.Connection connection) |
void |
setTimeToCloseConnectionNs(long timeToCloseConnectionNs) |
void |
setTimeToGetConnectionNs(long timeToGetConnectionNs) |
void |
setUrl(java.lang.String url) |
public static ConnectionInformation fromDriver(java.sql.Driver driver, java.sql.Connection connection, long timeToGetConnectionNs)
driver - the Driver which created the connectionconnection - the connection created by the drivertimeToGetConnectionNs - the time it took to obtain the connection in nanosecondsConnectionInformation instancepublic static ConnectionInformation fromDataSource(javax.sql.CommonDataSource dataSource, java.sql.Connection connection, long timeToGetConnectionNs)
ConnectionInformation instance for a Connection which has been obtained via a
CommonDataSourcedataSource - the CommonDataSource which created the connectionconnection - the connection created by the dataSourcetimeToGetConnectionNs - the time it took to obtain the connection in nanosecondsConnectionInformation instancepublic static ConnectionInformation fromPooledConnection(javax.sql.PooledConnection pooledConnection, java.sql.Connection connection, long timeToGetConnectionNs)
ConnectionInformation instance for a Connection which has been obtained via a
PooledConnectionpooledConnection - the PooledConnection which created the connectionconnection - the connection created by the pooledConnectiontimeToGetConnectionNs - the time it took to obtain the connection in nanosecondsConnectionInformation instancepublic static ConnectionInformation fromDriver(java.sql.Driver driver)
driver - the Driver which created the connectionConnectionInformation instancepublic static ConnectionInformation fromDataSource(javax.sql.CommonDataSource dataSource)
ConnectionInformation instance for a Connection which will be obtained via a
CommonDataSourcedataSource - the CommonDataSource which created the connectionConnectionInformation instancepublic static ConnectionInformation fromPooledConnection(javax.sql.PooledConnection pooledConnection)
ConnectionInformation instance for a Connection which will be obtained via a
PooledConnectionpooledConnection - the PooledConnection which created the connectionConnectionInformation instancepublic static ConnectionInformation fromTestConnection(java.sql.Connection connection)
connection - the underlying connection (possibly a mock)ConnectionInformation instancepublic int getConnectionId()
public java.lang.String getSql()
public java.lang.String getSqlWithValues()
getSqlWithValues in interface LoggableSQL having '?' replaced with real values used.public javax.sql.CommonDataSource getDataSource()
dataSource which created the connection
or null if it wasn't created via a CommonDataSource.dataSource which created the connectionpublic java.sql.Driver getDriver()
driver which created the connectionpublic java.sql.Connection getConnection()
ConnectionConnectionpublic void setConnection(java.sql.Connection connection)
public javax.sql.PooledConnection getPooledConnection()
pooledConnection which created the connection
or null if it wasn't created via a PooledConnection.pooledConnection which created the connectionpublic long getTimeToGetConnectionNs()
public void setTimeToGetConnectionNs(long timeToGetConnectionNs)
public long getTimeToCloseConnectionNs()
public void setTimeToCloseConnectionNs(long timeToCloseConnectionNs)
public ConnectionInformation getConnectionInformation()
getConnectionInformation in interface Loggablepublic void setUrl(java.lang.String url)
public java.lang.String getUrl()
Driver.connect(String, Properties),
returns the url which was used to create the connection.
Returns null otherwise.url used to create the connection, may be null