\PG\MSF\PoolsAsynPool

Class AsynPool

Summary

Methods
Properties
Constants
__construct()
addTokenCallback()
distribute()
serverInit()
workerInit()
pushToPool()
getSync()
$config
MAX_TOKEN
No protected methods found
$commands
$pool
$callBacks
$workerId
$server
$swooleServer
$token
$waitConnectNum
$asynManager
N/A
No private methods found
No private properties found
N/A

Constants

MAX_TOKEN

MAX_TOKEN

TOKEN最大值

Properties

$config

$config : \Noodlehaus\Config

Type

\Noodlehaus\Config — 配置对象

$commands

$commands : \SplQueue

Type

\SplQueue — 待执行命令队列

$pool

$pool : \SplQueue

Type

\SplQueue — 连接池

$callBacks

$callBacks : array

Type

array — 回调函数

$workerId

$workerId : integer

Type

integer — worker进程ID

$server

$server : \swoole_server

Type

\swoole_server — swoole_server实例

$swooleServer

$swooleServer : \PG\MSF\MSFServer

Type

\PG\MSF\MSFServer — server运行实例

$token

$token : integer

Type

integer — 回调Token

$waitConnectNum

$waitConnectNum : integer

Type

integer — 待连接数量

Methods

__construct()

__construct(\Noodlehaus\Config  $config) 

AsynPool constructor.

Parameters

\Noodlehaus\Config $config

配置对象

addTokenCallback()

addTokenCallback(callable  $callback) : integer

注册回调

Parameters

callable $callback

回调函数

Returns

integer

distribute()

distribute(array  $data) : $this

分发消息

Parameters

array $data

待分发数据

Returns

$this

serverInit()

serverInit(\PG\MSF\MSFServer  $swooleServer, \PG\MSF\Pools\AsynPoolManager  $asynManager) : $this

初始化

Parameters

\PG\MSF\MSFServer $swooleServer

Server实例

\PG\MSF\Pools\AsynPoolManager $asynManager

异步连接池管理器

Returns

$this

workerInit()

workerInit(integer  $workerId) : $this

初始化workerId

Parameters

integer $workerId

worker进程ID

Returns

$this

pushToPool()

pushToPool(mixed  $client) : $this

归还连接

Parameters

mixed $client

连接对象

Returns

$this

getSync()

getSync() : mixed

获取同步

Returns

mixed