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 connection
connection
- the connection
created by the driver
timeToGetConnectionNs
- 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
CommonDataSource
dataSource
- the CommonDataSource
which created the connection
connection
- the connection
created by the dataSource
timeToGetConnectionNs
- 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
PooledConnection
pooledConnection
- the PooledConnection
which created the connection
connection
- the connection
created by the pooledConnection
timeToGetConnectionNs
- the time it took to obtain the connection in nanosecondsConnectionInformation
instancepublic static ConnectionInformation fromDriver(java.sql.Driver driver)
driver
- the Driver
which created the connection
ConnectionInformation
instancepublic static ConnectionInformation fromDataSource(javax.sql.CommonDataSource dataSource)
ConnectionInformation
instance for a Connection
which will be obtained via a
CommonDataSource
dataSource
- the CommonDataSource
which created the connection
ConnectionInformation
instancepublic static ConnectionInformation fromPooledConnection(javax.sql.PooledConnection pooledConnection)
ConnectionInformation
instance for a Connection
which will be obtained via a
PooledConnection
pooledConnection
- the PooledConnection
which created the connection
ConnectionInformation
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 Loggable
SQL
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 connection
public java.sql.Driver getDriver()
driver
which created the connection
public java.sql.Connection getConnection()
Connection
Connection
public 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 connection
public long getTimeToGetConnectionNs()
public void setTimeToGetConnectionNs(long timeToGetConnectionNs)
public long getTimeToCloseConnectionNs()
public void setTimeToCloseConnectionNs(long timeToCloseConnectionNs)
public ConnectionInformation getConnectionInformation()
getConnectionInformation
in interface Loggable
public 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