ThreadPool

php\lang\ThreadPool

Class ThreadPool

Methods


__construct()

private

isScheduled()

Is Scheduled ?

Returns:bool
isShutdown()

Is Shutdown?

Returns:bool
isTerminated()
Returns:bool
execute($runnable, $env = null)

Execute some $runnable via the Executor Service

Parameters:
submit($runnable, $env = null)
Parameters:
Returns:

php\concurrent\Future

schedule($runnable, $delay, $env = null)
Parameters:
Returns:

php\concurrent\Future

shutdown()
shutdownNow()
awaitTermination($timeout)

Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.

throws php\lang\\Exception

Parameters:
  • $timeoutint - - in milliseconds
Returns:

bool

static create($coreSize, $maxSize, $keepAliveTime = 0)
Parameters:
  • $coreSizeint - the number of threads to keep in the pool, even if they are idle
  • $maxSizeint - the maximum number of threads to allow in the pool
  • $keepAliveTimeint - in millis
Returns:

php\lang\ThreadPool

static createFixed($max)
Parameters:
  • $maxint
Returns:

php\lang\ThreadPool

static createCached
Returns:php\lang\ThreadPool
static createSingle

Creates an Executor that uses a single worker thread operating off an unbounded queue.

Returns:php\lang\ThreadPool
static createScheduled($corePoolSize)

Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically.

Parameters:
  • $corePoolSizeint
Returns:

php\lang\ThreadPool