const class sql::SqlConnPool

sys::Obj
  sql::SqlConnPool

Source

SqlConnPool manages a pool of reusable SQL connections

checkLinger

Void checkLinger()

Source

Close idle connections that have lingered past the linger timeout.

close

Void close()

Source

Close all connections and raise exception on any new executes

execute

Void execute(|SqlConn| f)

Source

Allocate a SQL connection inside the given callback. If a connection cannot be acquired before timeout elapses then a TimeoutErr is raised. Do not close the connection inside the callback.

isClosed

Bool isClosed()

Source

Return if close has been called.

linger

const Duration linger := 5min

Source

Time to linger an idle connection before closing it. An external actor must call checkLinger periodically to close idle connetions.

log

const Log log := Log.get("sqlPool")

Source

Logger

make

new make(|This|? f)

Source

It-block construtor

maxConns

const Int maxConns := 10

Source

Max number of simultaneous connections to allow before blocking threads

onClose

protected virtual Void onClose(SqlConn c)

Source

onClose is invoked just before a connection is closed by the pool. This method can be used to clean up any state owned by the connection, for example by closing prepared Statements that are stored in the connection's stash.

onOpen

protected virtual Void onOpen(SqlConn c)

Source

onOpen is invoked just after a connection is opened by the pool. This method can be used to modify the newly opened connection, for example by turning off autoCommit.

password

const Str? password

Source

Connection password

timeout

const Duration timeout := 30sec

Source

Max time to block waiting for a connection before raising TimeoutErr

uri

const Str uri

Source

Connection URI

username

const Str? username

Source

Connection username