/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which will be obtained via a * {@link CommonDataSource} * * @param dataSource the {@link javax.sql.CommonDataSource} which created the {@link #connection} * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDataSource(CommonDataSource dataSource) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.dataSource = dataSource; return connectionInformation; }
/** * This method should only be used in test scenarios * * @param connection the underlying connection (possibly a mock) * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromTestConnection(Connection connection) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.connection = connection; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which will be obtained via a * {@link PooledConnection} * * @param pooledConnection the {@link PooledConnection} which created the {@link #connection} * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromPooledConnection(PooledConnection pooledConnection) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.pooledConnection = pooledConnection; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which will be obtained via a * {@link Driver} * * @param driver the {@link Driver} which created the {@link #connection} * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDriver(Driver driver) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.driver = driver; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a * {@link PooledConnection} * * @param pooledConnection the {@link PooledConnection} which created the {@link #connection} * @param connection the {@link #connection} created by the {@link #pooledConnection} * @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromPooledConnection(PooledConnection pooledConnection, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.pooledConnection = pooledConnection; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a * {@link Driver} * * @param driver the {@link Driver} which created the {@link #connection} * @param connection the {@link #connection} created by the {@link #driver} * @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDriver(Driver driver, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.driver = driver; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a * {@link CommonDataSource} * * @param dataSource the {@link javax.sql.CommonDataSource} which created the {@link #connection} * @param connection the {@link #connection} created by the {@link #dataSource} * @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDataSource(CommonDataSource dataSource, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.dataSource = dataSource; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which will be obtained via a * {@link PooledConnection} * * @param pooledConnection the {@link PooledConnection} which created the {@link #connection} * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromPooledConnection(PooledConnection pooledConnection) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.pooledConnection = pooledConnection; return connectionInformation; }
/** * This method should only be used in test scenarios * * @param connection the underlying connection (possibly a mock) * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromTestConnection(Connection connection) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.connection = connection; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which will be obtained via a * {@link CommonDataSource} * * @param dataSource the {@link javax.sql.CommonDataSource} which created the {@link #connection} * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDataSource(CommonDataSource dataSource) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.dataSource = dataSource; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which will be obtained via a * {@link Driver} * * @param driver the {@link Driver} which created the {@link #connection} * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDriver(Driver driver) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.driver = driver; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a * {@link Driver} * * @param driver the {@link Driver} which created the {@link #connection} * @param connection the {@link #connection} created by the {@link #driver} * @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDriver(Driver driver, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.driver = driver; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a * {@link PooledConnection} * * @param pooledConnection the {@link PooledConnection} which created the {@link #connection} * @param connection the {@link #connection} created by the {@link #pooledConnection} * @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromPooledConnection(PooledConnection pooledConnection, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.pooledConnection = pooledConnection; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }
/** * Creates a new {@link ConnectionInformation} instance for a {@link Connection} which has been obtained via a * {@link CommonDataSource} * * @param dataSource the {@link javax.sql.CommonDataSource} which created the {@link #connection} * @param connection the {@link #connection} created by the {@link #dataSource} * @param timeToGetConnectionNs the time it took to obtain the connection in nanoseconds * @return a new {@link ConnectionInformation} instance */ public static ConnectionInformation fromDataSource(CommonDataSource dataSource, Connection connection, long timeToGetConnectionNs) { final ConnectionInformation connectionInformation = new ConnectionInformation(); connectionInformation.dataSource = dataSource; connectionInformation.connection = connection; connectionInformation.timeToGetConnectionNs = timeToGetConnectionNs; return connectionInformation; }