public static final class DefaultHook.InitConnection extends DefaultHook implements Hook.InitConnection
DefaultHook.CloseConnection, DefaultHook.GetConnectionTimeout, DefaultHook.GetConnectionTiming, DefaultHook.InitConnection, DefaultHook.QueryTiming, DefaultHook.ResultSetSizeHook.CloseConnection, Hook.DestroyConnection, Hook.GetConnection, Hook.GetConnectionTimeout, Hook.InitConnection, Hook.MethodInvocation, Hook.ResultSetRetrieval, Hook.StatementExecution, Hook.StatementProceedingPoint| Constructor and Description |
|---|
InitConnection(ViburConfig config) |
| Modifier and Type | Method and Description |
|---|---|
void |
on(Connection rawConnection,
long takenNanos)
A programming hook that will be invoked only once after the raw JDBC Connection is first created.
|
public InitConnection(ViburConfig config)
public void on(Connection rawConnection, long takenNanos) throws SQLException
Hook.InitConnectionThe takenNanos parameter includes as a minimum the time taken to establish (or attempt to
establish) one physical connection to the database, plus possibly the time taken to make up to
ViburConfig.acquireRetryAttempts that are separated by a ViburConfig.acquireRetryDelayInMs,
if there were errors while trying to establish the connection.
Worth noting that since version 19.0 the rawConnection parameter can be null, which
means that the attempt to establish a connection, plus all reattempts, were unsuccessful.
This hook complements the DestroyConnection hook, which is invoked
after the raw JDBC Connection is destroyed.
on in interface Hook.InitConnectionrawConnection - the just created raw JDBC Connection; note that it can be
null if we were unable to establish a connection to the databasetakenNanos - the time taken to establish (or attempt to establish) the connection in nanosecondsSQLException - to indicate that an SQL error has occurredCopyright © 2013-2019 vibur.org. All Rights Reserved.