/**
  * gets the PID number from the PID file and caches it
  *
  * @param bool $skipCache
  * @return int
  */
 protected function getPid($skipCache = false)
 {
     $skipCache = (bool) $skipCache;
     if (!$skipCache && !empty($this->pid) && $this->pid instanceof Pid) {
         return $this->pid->getPid();
     }
     $pid = $this->pidFactory->create($this->poolPidFile);
     $pidNum = $pid->getPid();
     $this->pid = $pid;
     return $pidNum;
 }
Exemple #2
0
 public function testClean()
 {
     $testFile = "test.pid";
     $pidNumber = 12345;
     $pid = new Pid($this->getPath($testFile), $pidNumber);
     $vfs = vfsStreamWrapper::getRoot();
     $this->assertTrue($vfs->hasChild($testFile));
     $pid->cleanPid();
     $this->assertFalse($vfs->hasChild($testFile));
 }