Пример #1
0
 /**
  * Construct method
  *
  * @param GearmanCacheWrapper $gearmanCacheWrapper GearmanCacheWrapper
  * @param array               $defaultSettings     The default settings for the bundle
  */
 public function __construct(GearmanCacheWrapper $gearmanCacheWrapper, array $defaultSettings)
 {
     parent::__construct($gearmanCacheWrapper, $defaultSettings);
     $this->executeOptionsResolver = new OptionsResolver();
     $this->executeOptionsResolver->setDefaults(array('iterations' => null, 'minimum_execution_time' => null, 'timeout' => null))->setAllowedTypes('iterations', array('null', 'scalar'))->setAllowedTypes('minimum_execution_time', array('null', 'scalar'))->setAllowedTypes('timeout', array('null', 'scalar'));
     $this->stopWorkSignalReceived = false;
     /**
      * If the pcntl_signal exists, subscribe to the terminate and restart events for graceful worker stops.
      */
     if (false !== function_exists('pcntl_signal')) {
         declare (ticks=1);
         pcntl_signal(SIGTERM, array($this, "handleSystemSignal"));
         pcntl_signal(SIGHUP, array($this, "handleSystemSignal"));
     }
 }
Пример #2
0
 /**
  * Construct method
  *
  * @param GearmanCacheWrapper $gearmanCacheWrapper GearmanCacheWrapper
  * @param array               $defaultSettings     The default settings for the bundle
  */
 public function __construct(GearmanCacheWrapper $gearmanCacheWrapper, array $defaultSettings)
 {
     parent::__construct($gearmanCacheWrapper, $defaultSettings);
     $this->executeOptionsResolver = new OptionsResolver();
     $this->executeOptionsResolver->setDefaults(array('iterations' => null, 'minimum_execution_time' => null, 'timeout' => null))->setAllowedTypes(array('iterations' => array('null', 'scalar'), 'minimum_execution_time' => array('null', 'scalar'), 'timeout' => array('null', 'scalar')));
 }