class Pool extends ObjectPool

Properties

protected Channel $channel from  ObjectPool
protected array<int, true> $managed from  ObjectPool
protected array<int, true> $borrowed from  ObjectPool
protected array<int, int> $creationTimes from  ObjectPool
protected array<int, int> $releaseTimes from  ObjectPool
protected int $lastUsedAt from  ObjectPool
protected bool $closed from  ObjectPool
protected int $acquiring from  ObjectPool
protected int $creating from  ObjectPool
protected Closure|null $destroyCallback from  ObjectPool

Methods

__construct(Options $sentryOptions, PoolOptions $poolOptions)

Create an object pool.

object
get()

Retrieve an object from the pool.

void
release(object $object)

Release an object back to the pool.

void
discard(object $object)

Destroy a checked-out object instead of returning it to the pool.

void
sweepExpired()

Destroy idle objects that exceed the maximum lifetime.

void
trimIdle()

Destroy idle objects past the maximum idle time down to the retention floor.

void
close()

Close the pool and destroy all idle objects.

bool
isClosed()

Determine if the pool is closed.

bool
isIdle()

Determine if the entire pool has exceeded its idle TTL.

int
getBorrowedObjectNumber()

Return the number of objects currently checked out.

int
getCurrentObjectNumber()

Return the current number of objects managed by the pool.

int
getObjectNumberInPool()

Return the number of objects currently available in the pool.

getOptions()

Get the normalized pool options.

array
getStats()

Return statistics about the pool's current state.

object
createObject()

Create a new object for the pool.

int
assertBorrowed(object $object)

Assert an object is currently checked out from this pool.

void
requeue(object $object)

Return an object to the idle channel without recording user activity.

void
destroyObject(object $object)

Destroy an object through the pool's single cleanup path.

bool
exceedsMaxLifetime(object $object)

Determine if an object has exceeded its maximum lifetime.

int
nanoseconds(float $seconds)

Convert seconds to nanoseconds without overflowing integer arithmetic.

int
deadline(float $seconds)

Build a monotonic deadline without overflowing at long durations or uptimes.

HttpClientInterface
getHttpClient()

No description

Details

at line 21
__construct(Options $sentryOptions, PoolOptions $poolOptions)

Create an object pool.

Parameters

Options $sentryOptions
PoolOptions $poolOptions

in ObjectPool at line 58
object get()

Retrieve an object from the pool.

Return Value

object

in ObjectPool at line 82
void release(object $object)

Release an object back to the pool.

Parameters

object $object

Return Value

void

in ObjectPool at line 103
void discard(object $object)

Destroy a checked-out object instead of returning it to the pool.

Parameters

object $object

Return Value

void

in ObjectPool at line 114
void sweepExpired()

Destroy idle objects that exceed the maximum lifetime.

Return Value

void

in ObjectPool at line 134
void trimIdle()

Destroy idle objects past the maximum idle time down to the retention floor.

Return Value

void

in ObjectPool at line 162
void close()

Close the pool and destroy all idle objects.

Return Value

void

in ObjectPool at line 179
bool isClosed()

Determine if the pool is closed.

Return Value

bool

in ObjectPool at line 187
bool isIdle()

Determine if the entire pool has exceeded its idle TTL.

Return Value

bool

in ObjectPool at line 198
int getBorrowedObjectNumber()

Return the number of objects currently checked out.

Return Value

int

in ObjectPool at line 206
int getCurrentObjectNumber()

Return the current number of objects managed by the pool.

Return Value

int

in ObjectPool at line 214
int getObjectNumberInPool()

Return the number of objects currently available in the pool.

Return Value

int

in ObjectPool at line 222
PoolOptions getOptions()

Get the normalized pool options.

Return Value

PoolOptions

in ObjectPool at line 232
array getStats()

Return statistics about the pool's current state.

Return Value

array

at line 28
protected object createObject()

Create a new object for the pool.

The factory may yield and allow another coroutine to close the pool.

Return Value

object

in ObjectPool at line 255
protected int assertBorrowed(object $object)

Assert an object is currently checked out from this pool.

Parameters

object $object

Return Value

int

in ObjectPool at line 273
protected void requeue(object $object)

Return an object to the idle channel without recording user activity.

Parameters

object $object

Return Value

void

in ObjectPool at line 281
protected void destroyObject(object $object)

Destroy an object through the pool's single cleanup path.

Parameters

object $object

Return Value

void

in ObjectPool at line 309
protected bool exceedsMaxLifetime(object $object)

Determine if an object has exceeded its maximum lifetime.

Parameters

object $object

Return Value

bool

in ObjectPool at line 405
protected int nanoseconds(float $seconds)

Convert seconds to nanoseconds without overflowing integer arithmetic.

Parameters

float $seconds

Return Value

int

in ObjectPool at line 415
protected int deadline(float $seconds)

Build a monotonic deadline without overflowing at long durations or uptimes.

Parameters

float $seconds

Return Value

int

at line 38
protected HttpClientInterface getHttpClient()

No description

Return Value

HttpClientInterface