Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
ProcessManager Class Reference

Public Member Functions

 __construct (\Magento\Framework\App\ResourceConnection $resource, \Magento\Framework\Registry $registry=null, int $threadsCount=null)
 
 execute ($userFunctions)
 

Data Fields

const THREADS_COUNT = 'MAGE_INDEXER_THREADS_COUNT'
 

Detailed Description

Provide functionality for executing user functions in multi-thread mode.

Definition at line 13 of file ProcessManager.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\ResourceConnection  $resource,
\Magento\Framework\Registry  $registry = null,
int  $threadsCount = null 
)
Parameters
\Magento\Framework\App\ResourceConnection$resource
\Magento\Framework\Registry$registry
int | null$threadsCount

Definition at line 37 of file ProcessManager.php.

41  {
42  $this->resource = $resource;
43  if (null === $registry) {
45  \Magento\Framework\Registry::class
46  );
47  }
48  $this->registry = $registry;
49  $this->threadsCount = (int)$threadsCount;
50  }
$resource
Definition: bulk.php:12

Member Function Documentation

◆ execute()

execute (   $userFunctions)

Execute user functions

Parameters
\Traversable$userFunctions

Definition at line 57 of file ProcessManager.php.

58  {
59  if ($this->threadsCount > 1 && $this->isCanBeParalleled() && !$this->isSetupMode() && PHP_SAPI == 'cli') {
60  $this->multiThreadsExecute($userFunctions);
61  } else {
62  $this->simpleThreadExecute($userFunctions);
63  }
64  }

Field Documentation

◆ THREADS_COUNT

const THREADS_COUNT = 'MAGE_INDEXER_THREADS_COUNT'

Threads count environment variable name

Definition at line 18 of file ProcessManager.php.


The documentation for this class was generated from the following file: