# \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
abstract

File
  Pools/AsynPool.php
Package
  MSF\Pools
Class hierarchy
  \PG\MSF\Pools\AsynPool
Implements
  \PG\MSF\Pools\IAsynPool

## Tags

None found

## Constants

### MAX_TOKEN

    MAX_TOKEN

TOKEN最大值

#

## Tags

None found

## Properties

### $config

    $config : \Noodlehaus\Config

#### Type

\Noodlehaus\Config — 配置对象

#

## Tags

None found

### $commands

    $commands : \SplQueue

#### Type

\SplQueue — 待执行命令队列

#

## Tags

None found

### $pool

    $pool : \SplQueue

#### Type

\SplQueue — 连接池

#

## Tags

None found

### $callBacks

    $callBacks : array

#### Type

array — 回调函数

#

## Tags

None found

### $workerId

    $workerId : integer

#### Type

integer — worker进程ID

#

## Tags

None found

### $server

    $server : \swoole_server

#### Type

\swoole_server — swoole_server实例

#

## Tags

None found

### $swooleServer

    $swooleServer : \PG\MSF\MSFServer

#### Type

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

#

## Tags

None found

### $token

    $token : integer

#### Type

integer — 回调Token

#

## Tags

None found

### $waitConnectNum

    $waitConnectNum : integer

#### Type

integer — 待连接数量

#

## Tags

None found

### $asynManager

    $asynManager : \PG\MSF\Pools\AsynPoolManager

#### Type

\PG\MSF\Pools\AsynPoolManager — 连接池管理器

#

## Tags

None found

## Methods

### __construct()

    __construct(\Noodlehaus\Config  $config)

AsynPool constructor.

#### Parameters

\Noodlehaus\Config | $config | 配置对象

#

## Tags

None found

### addTokenCallback()

    addTokenCallback(callable  $callback) : integer

注册回调

#### Parameters

callable | $callback | 回调函数

#### Returns

integer

#

## Tags

None found

### distribute()

    distribute(array  $data) : $this

分发消息

#### Parameters

array | $data | 待分发数据

#### Returns

$this

#

## Tags

None found

### 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

#

## Tags

None found

### workerInit()

    workerInit(integer  $workerId) : $this

初始化workerId

#### Parameters

integer | $workerId | worker进程ID

#### Returns

$this

#

## Tags

None found

### pushToPool()

    pushToPool(mixed  $client) : $this

归还连接

#### Parameters

mixed | $client | 连接对象

#### Returns

$this

#

## Tags

None found

### getSync()

    getSync() : mixed

获取同步

#### Returns

mixed

#

abstract

## Tags

None found

### AsynPool.php