Documentation

DelegatingWorkerPool
in package
implements LimitedWorkerPool uses ForbidCloning, ForbidSerialization

FinalYes

Table of Contents

Interfaces

LimitedWorkerPool
An interface for worker pools.

Properties

$limit  : int
$pendingWorkerCount  : int
$pool  : WorkerPool
$waiting  : SplQueue<string|int, DeferredFuture<string|int, Worker|null>>
$workerStorage  : array<int, Worker>

Methods

__construct()  : mixed
__serialize()  : never
__unserialize()  : never
getIdleWorkerCount()  : int
Gets the number of workers that are currently idle.
getWorker()  : Worker
Gets a worker from the pool. The worker is marked as busy and will only be reused if the pool runs out of idle workers. The worker will be automatically marked as idle once no references to the returned worker remain.
getWorkerCount()  : int
Gets the number of workers currently running in the pool.
getWorkerLimit()  : int
Gets the maximum number of workers the pool may spawn to handle concurrent tasks.
isIdle()  : bool
Checks if the worker is currently idle.
isRunning()  : bool
Checks if the worker is running.
kill()  : void
Immediately kills the context.
shutdown()  : void
Gracefully shutdown the worker once all outstanding tasks have completed executing. Returns once the worker has been shutdown.
submit()  : Execution<TReceive, TSend>
__clone()  : mixed
clearWaiting()  : void
push()  : void
selectWorker()  : Worker

Properties

Methods

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : never
Parameters
$data : array<string|int, mixed>
Return values
never

getIdleWorkerCount()

Gets the number of workers that are currently idle.

public getIdleWorkerCount() : int
Return values
int

The number of idle workers.

getWorker()

Gets a worker from the pool. The worker is marked as busy and will only be reused if the pool runs out of idle workers. The worker will be automatically marked as idle once no references to the returned worker remain.

public getWorker() : Worker

This method does not guarantee the worker will be dedicated to a particular task, rather is designed if you wish to send a series of tasks to a single worker. For a dedicated worker, create a new worker using a WorkerFactory or createWorker().

Return values
Worker

getWorkerCount()

Gets the number of workers currently running in the pool.

public getWorkerCount() : int
Return values
int

The number of workers.

getWorkerLimit()

Gets the maximum number of workers the pool may spawn to handle concurrent tasks.

public getWorkerLimit() : int
Return values
int

The maximum number of workers.

isIdle()

Checks if the worker is currently idle.

public isIdle() : bool
Return values
bool

isRunning()

Checks if the worker is running.

public isRunning() : bool
Return values
bool

True if the worker is running, otherwise false.

shutdown()

Gracefully shutdown the worker once all outstanding tasks have completed executing. Returns once the worker has been shutdown.

public shutdown() : void

clearWaiting()

private clearWaiting(Throwable $exception) : void
Parameters
$exception : Throwable

        
On this page

Search results