ConnectionLease
class ConnectionLease implements NonCopyableContext
Keep a caller's logical connection stable while its physical sessions are pooled.
PDO connections receive the borrowed handles directly. Drivers implementing LeasableConnection build their own logical connection and ask the lease for the physical connection whenever an operation needs it.
Properties
| Connection | $connection | ||
| protected PooledConnection|null | $pooledConnection | ||
| protected bool | $ended | ||
| protected null|PDO | $pdoResolver | ||
| protected null|PDO | $readPdoResolver |
Methods
Create a logical connection from its initially borrowed physical session.
Get the held pooled connection, borrowing one when the session was returned early.
Resolve a physical handle and publish its generation to the logical owner.
Resolve a driver's physical connection and publish its generation to the logical owner.
Replace the held physical session and reconnect the logical owner.
Release the held session when no operation requires it.
End logical ownership and release the currently held physical session.
End logical ownership and discard the currently held physical session.
Determine whether logical ownership has ended.
Remove references to a session before its slot becomes available again.
Discard a failed acquisition without replacing its exception.
Details
at line 42
__construct(DatabasePool $pool, PooledConnection $pooledConnection, ConnectionFactory $factory, Connection $physicalConnection)
Create a logical connection from its initially borrowed physical session.
at line 76
protected PooledConnection
heldPooledConnection()
Get the held pooled connection, borrowing one when the session was returned early.
at line 95
protected PDO
resolvePdo(bool $read = false)
Resolve a physical handle and publish its generation to the logical owner.
at line 128
protected Connection&LeasableConnection
resolvePhysicalConnection()
Resolve a driver's physical connection and publish its generation to the logical owner.
at line 151
Connection
reconnect()
Replace the held physical session and reconnect the logical owner.
at line 172
void
releaseIfIdle()
Release the held session when no operation requires it.
at line 187
void
release()
End logical ownership and release the currently held physical session.
at line 196
void
discard()
End logical ownership and discard the currently held physical session.
at line 205
bool
hasEnded()
Determine whether logical ownership has ended.
at line 213
void
detach()
Remove references to a session before its slot becomes available again.
at line 228
protected void
discardAfterFailure(Throwable $exception)
Discard a failed acquisition without replacing its exception.