创建新的栈，用于储存相应的对象

@param string $poolName 对象池名称
@return mixed
@throws Exception
182689
private function applyNewPool($poolName)
    {
        if (array_key_exists($poolName, $this->map)) {
            throw new Exception('the name is exists in pool map');
        }
        $this->map[$poolName] = new \SplStack();

        return $this->map[$poolName];
    }
782833
private function queueExists($queueName)
    {
        try {
            $this->resolveUrl($queueName);

            return true;
        } catch (\InvalidArgumentException $exception) {
            return false;
        } catch (SqsException $exception) {
            if ($previousException = $exception->getPrevious()) {
                switch ($previousException->getCode()) {
                    case self::AWS_SQS_EXCEPTION_BAD_REQUEST:
                    case self::AWS_SQS_EXCEPTION_NOT_FOUND:
                        return false;
                }
            }

            throw $exception;
        }
    }
1311010
public function get($serviceName)
    {
        if (! $this->has($serviceName)) {
            throw new NotFoundException('Error: Could not find service');
        }

        $serviceProvider = $this->serviceProviders[$serviceName];

        if (! is_string($serviceProvider)) {
            throw new ContainerException(
                'Error: Expected class name of service provider as string but got "'.gettype($serviceProvider).'"'
            );
        }

        try {
            // The name of the service provider class is stored, try to create an object from it
            /** @var AbstractServiceProvider $serviceProvider */
            $serviceProvider = new $serviceProvider($serviceName, $this);
        } catch (\Exception $exception) {
            throw new ContainerException('Error: Could not create service provider via reflection');
        }

        if (! is_a($serviceProvider, AbstractServiceProvider::class)) {
            throw new ContainerException(
                'Error: Service provider object does not inherit from AbstractServiceProvider'
            );
        }

        try {
            // Try to make the provider provide the service. Might throw an exception.
            $object = $serviceProvider->provide();
        } catch (\Exception $exception) {
            if (is_a($exception, ContainerException::class)) {
                /** @var ContainerException $exception */
                throw $exception;
            } else {
                throw new ContainerException(
                    'Error: Service provider could not create service. Reason: '.$exception->getMessage()
                );
            }
        }

        if (! is_object($object)) {
            throw new ContainerException('Error: Service provider did not provide a valid service object');
        }

        return $object;
    }
142549
public function createQueue(string $queueName, array $attributes=array()) {
        if(!$queueName){
            return $this->error('参数有误');
        }
        $request = new CreateQueueRequest($queueName, $this->makeQueueAttributes($attributes));
        try{
            $this->client->createQueue($request);
            return $this->success('创建队列成功');
        }catch(MnsException $exception){
            return $this->parseException($exception, '创建队列');
        }
    }
677993
protected function getCrypt()
    {
        static $crypt;

        if (!$crypt) {
            if (empty($this->encodingAESKey) || empty($this->token)) {
                throw new Exception("加密模式下 'encodingAESKey' 与 'token' 都不能为空！");
            }

            $crypt = new Crypt($this->appId, $this->token, $this->encodingAESKey);
        }

        return $crypt;
    }
651629
public function newInstance($className)
    {

        // lock the method
        \Mutex::lock($this->mutex);

        // we're not dispatched
        $this->dispatched = false;

        // initialize the data
        $this->className = $className;

        // notify the thread
        $this->notify();

        // wait till we've dispatched the request
        while ($this->dispatched === false) {
            usleep(100);
        }

        // try to load the last created instance
        if (isset($this->instances[$last = sizeof($this->instances) - 1])) {
            $instance = $this->instances[$last];
        } else {
            throw new \Exception('Requested instance can\'t be created');
        }

        // unlock the method
        \Mutex::unlock($this->mutex);

        // return the created instance
        return $instance;
    }
516676
private function handleException($poolKey, $operation, CachePoolException $exception)
    {
        if (!$this->options['skip_on_failure']) {
            throw $exception;
        }

        $this->log(
            'warning',
            sprintf('Removing pool "%s" from chain because it threw an exception when executing "%s"', $poolKey,
                $operation),
            ['exception' => $exception]
        );

        unset($this->pools[$poolKey]);
    }
779724
public static function getPool(string $name): PoolInterface
    {
        $collector = PoolCollector::getCollector();
        if (!isset($collector[$name])) {
            throw new InvalidArgumentException("the pool of $name is not exist!");
        }

        $poolBeanName = $collector[$name];

        return self::getBean($poolBeanName);
    }
709737
protected function getConfigException($exceptionName)
    {
        $exceptionParentName = get_parent_class($exceptionName);

        if (in_array(
            'M6Web\Bundle\ApiExceptionBundle\Exception\Interfaces\ExceptionInterface',
            class_implements($exceptionParentName)
        )) {
            $parentConfig = $this->getConfigException($exceptionParentName);
        } else {
            $parentConfig = $this->defaultConfig;
        }

        if (isset($this->exceptions[$exceptionName])) {
            return array_merge($parentConfig, $this->exceptions[$exceptionName]);
        }

        return $parentConfig;
    }
39462
function getPool(string $key):?AbstractPool
    {
        if(isset($this->anonymousMap[$key])){
            $key = $this->anonymousMap[$key];
        }
        if(isset($this->pool[$key])){
            $item = $this->pool[$key];
            if($item instanceof AbstractPool){
                return $item;
            }else{
                $class = $item['class'];
                if(isset($item['config'])){
                    $obj = new $class($item['config']);
                    $this->pool[$key] = $obj;
                }else{
                    $config = clone $this->defaultConfig;
                    $createCall = $item['call'];
                    $obj = new $class($config,$createCall);
                    $this->pool[$key] = $obj;
                    $this->anonymousMap[get_class($obj)] = $key;
                }
                return $this->getPool($key);
            }
        }else{
            //先尝试动态注册
            $ret = false;
            try{
                $ret = $this->register($key);
            }catch (\Throwable $throwable){
                //此处异常不向上抛。
            }
            if($ret){
                return $this->getPool($key);
            }else if(class_exists($key) && $this->registerAnonymous($key)){
                return $this->getPool($key);
            }
            return null;
        }
    }
1195414
protected function create(string $filename){
        $fileSystem = new Filesystem();
        $source = $this->config['source'] ?: 'Source';
        $file_path = ROOT . '/' . $source;
        // 创建文件路径
        $fileSystem->exists($file_path) || $fileSystem->mkdir($file_path);

        $html = '';
        $html .= "---" . PHP_EOL;
        $html .= "title: " . $filename . PHP_EOL;
        $html .= "type: " . 'type' . PHP_EOL;
        $html .= "date: " . date('Y-m-d H:i:s') . PHP_EOL;
        $html .= "tags: " . $filename . PHP_EOL;
        $html .= "---" . PHP_EOL . PHP_EOL;
        $html .= "Create at ".date('Y-m-d H:i:s').PHP_EOL;
        $html .= 'You should edit this page as markdown'.PHP_EOL;

        $file_name = $file_path . '/' . $filename . '.md';
        if ($fileSystem->exists([$file_name])) {
            throw new Exception('Create '.$filename.'.php failed, this file exited!!!');
        }
        
        $status = file_put_contents($file_name, $html, LOCK_EX);
        if ($status === false) {
            throw new Exception('Create '.$filename.' failed!');
        }
    }
49048
public void newPoolInstance(CmsParameterConfiguration configuration, String poolName) throws CmsInitException {

        CmsDbPoolV11 pool;

        try {
            pool = new CmsDbPoolV11(configuration, poolName);
        } catch (Exception e) {

            CmsMessageContainer message = Messages.get().container(Messages.ERR_INIT_CONN_POOL_1, poolName);
            if (LOG.isErrorEnabled()) {
                LOG.error(message.key(), e);
            }
            throw new CmsInitException(message, e);
        }
        addPool(pool);
    }
1366175
public function add($classname)
    {
        if (is_string($classname) and ! class_exists($classname)) {
            throw new Exception(sprintf('Invalid filter object. Classname not exists %s.', $classname));
        }
        //app('antares.asset')->container('antares/foundation::application')->add('webpack_forms_basic', '/webpack/forms_basic.js', ['app_cache']);
        $filter = is_object($classname) ? $classname : $this->app->make($classname);
        array_push($this->filters, $filter);

        return $this;
    }
831254
public function select($index = 0) {

        $index = intval($index);

        if (isset($this->pool['master']) && !is_null($this->pool['master'])) {
            $res = $this->pool['master']->getHandler()->select($index);
            if (!$res) {
                throw new Exception('change selected database failed');
            }
        }

        if (isset($this->pool['slave']) && !is_null($this->pool['slave'])) {
            $res = $this->pool['slave']->getHandler()->select($index);
            if (!$res) {
                throw new Exception('change selected database failed');
            }
        }

        // 记录当前redis db
        $this->currentDb = $index;
    }
1047461
private function readFile($filename)
    {
        if (!is_file($filename)) {
            throw new Exception('Failed to find file '.$filename);
        }
        if (!is_readable($filename)) {
            throw new Exception('File is not readable: '.$filename);
        }
        $contents = @file_get_contents($filename);
        if ($contents === false) {
            throw new Exception('Failed to read file '.$filename);
        }
        $contents = str_replace(array("\r\n", "\r"), "\n", $contents);
        $contents = preg_replace('/([a-z_\\\\]+)::class\b/i', "'\\1'", $contents);
        $this->contents = $contents;
    }
197783
public function getConfigByFilename(string $filename)
    {
        if (!isset($this->config[$filename])) {
            throw new Exception(
                'The file '.$filename.' has not been found',
                $this::ERR_FILE_NOT_FOUND
            );
        }
        
        return $this->config[$filename];
    }
1081768
public ConnectionPool getPool(String poolName)
            throws ConnectionPoolNotFoundException {
        ConnectionPool connectionPool = null;

        try {
            if (h_ConnectionPools.containsKey(poolName)) {
                connectionPool = h_ConnectionPools.get(poolName);
            } else {
                // Error: pool was never initialized or name could not be found
                throw new ConnectionPoolNotFoundException("Connection pool "
                        + "not found: " + poolName);
            }
        } catch (Throwable th) {
            throw new ConnectionPoolNotFoundException("The specified connection "
                    + "pool \""
                    + poolName
                    + "\" could not be found. The underlying "
                    + "error was a "
                    + th.getClass().getName()
                    + "The message was \""
                    + th.getMessage() + "\".");
        }

        return connectionPool;
    }