This commit is contained in:
as2252258@163.com
2021-04-23 02:33:23 +08:00
parent 10c9e1801b
commit f9210d9971
2 changed files with 1 additions and 77 deletions
-73
View File
@@ -1,73 +0,0 @@
<?php
namespace Snowflake\Pool;
use Exception;
use ReflectionException;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
use Swoole\Coroutine;
/**
* Class ObjectPool
* @package Snowflake\Pool
*/
class ObjectPool extends \Snowflake\Abstracts\Pool
{
public int $max = 5000;
/**
* @param array $config
* @param callable $construct
* @return mixed
* @throws Exception
*/
public function load(mixed $config, callable $construct): mixed
{
if (is_object($config)) {
return $config;
}
$object = $this->getFromChannel($config, [$config, $construct]);
if (method_exists($object, 'clean')) {
$object->clean();
}
return $object;
}
/**
* @param string $name
* @param mixed $config
* @return mixed
*/
public function createClient(string $name, mixed $config): mixed
{
return call_user_func($config[1]);
}
/**
* @param string $name
*/
public function desc(string $name)
{
}
/**
* @param string $name
* @param $object
*/
public function release(string $name, mixed $object)
{
$this->push($name, $object);
}
}
+1 -4
View File
@@ -20,10 +20,7 @@ use Swoole\Coroutine\System;
abstract class Process extends \Swoole\Process implements SProcess abstract class Process extends \Swoole\Process implements SProcess
{ {
/** @var Application $application */
protected Application $application;
/** /**
* Process constructor. * Process constructor.
* @param $application * @param $application