Exemple #1
0
 /**
  * Reload Configuration every cycle
  *
  */
 protected function _updateConfiguration()
 {
     $config = @parse_ini_file($this->_configFile, true);
     if (empty($this->_configFile) || !isset($config['context_definitions']) || empty($config['context_definitions'])) {
         throw new Exception('Wrong configuration file provided.');
     }
     //First Execution, load build object
     $this->_queueContextList = ContextList::get($config['context_definitions']);
 }
Exemple #2
0
 /**
  * Reload Configuration every cycle
  *
  */
 protected function _updateConfiguration()
 {
     $config = @parse_ini_file($this->_configFile, true);
     if (empty($this->_configFile) || !isset($config['context_definitions']) || empty($config['context_definitions'])) {
         throw new Exception('Wrong configuration file provided.');
     }
     Log::$fileName = $config['loggerName'];
     $this->_context_definitions = $config['context_definitions'];
     if (empty($this->_contextIndex)) {
         $contextList = $this->_context_definitions;
     } else {
         $contextList = array($this->_context_definitions[$this->_contextIndex]);
     }
     if (empty($this->_queueContextList->list)) {
         //First Execution, load build object
         $this->_queueContextList = ContextList::get($contextList);
         //exit method
         return;
     }
     /**
      * Compares the keys from array1 against the keys from array2 and returns the difference.
      * This function is like array_diff() except the comparison is done on the keys instead of the values.
      *
      * <pre>
      *     array_diff:
      *     Compares array1 against one or more other arrays
      *     and returns the values in array1 that are not present in any of the other arrays.
      *</pre>
      *
      */
     if ($diff = array_diff_key($this->_queueContextList->list, ContextList::get($contextList)->list)) {
         //remove no more present contexts
         foreach ($diff as $_key => $_cont) {
             unset($this->_queueContextList->list[$_key]);
             $this->_destroyContext[] = $_cont;
         }
     }
     foreach ($this->_context_definitions as $contextName => $context) {
         if (isset($this->_queueContextList->list[$contextName])) {
             //update the max executor number for this element
             $this->_queueContextList->list[$contextName]->max_executors = $context['max_executors'];
         } else {
             //create a new Object executo context
             $this->_queueContextList->list[$contextName] = QueueInfo::buildFromArray($context);
         }
     }
 }