modify
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,9 +20,6 @@ use Swoole\Coroutine\System;
|
||||
abstract class Process extends \Swoole\Process implements SProcess
|
||||
{
|
||||
|
||||
/** @var Application $application */
|
||||
protected Application $application;
|
||||
|
||||
|
||||
/**
|
||||
* Process constructor.
|
||||
|
||||
Reference in New Issue
Block a user