Inheritance: extends AbstractPool
Example #1
0
 /**
  * @param integer $time start time
  */
 public function start($time = null)
 {
     try {
         if (is_null($time)) {
             $time = time();
         }
         $this->start_time = $time;
         $this->logger->info("start. date:" . date("Y-m-d H:i:s", $time) . ". pid:" . getmypid());
         $pool = new Pool();
         foreach ($this->missions as $mission) {
             if (!$mission->needRun($time)) {
                 continue;
             }
             try {
                 $mission->start();
             } catch (\Exception $e) {
                 $this->logException($e);
             }
             $pool->submit($mission);
         }
         $pool->wait();
     } catch (\Exception $e) {
         $this->logException($e);
     }
     unset($pool);
 }
Example #2
0
 public function signal($signal)
 {
     switch ($signal) {
         case SIGTERM:
             $this->pool->shutdown(SIGTERM);
             break;
     }
 }