Example #1
0
 /**
  * This is invoked on every iteration of the daemons while() loop.
  *
  * @param integer $timeout The timeout before the daemon wakes up
  *
  * @return void
  */
 public function iterate($timeout)
 {
     // call parent method and sleep for the default timeout
     parent::iterate($timeout);
     // create the requested timer instance
     $this->synchronized(function ($self) {
         // create the timer, only if we're NOT dispatched
         if ($self->dispatched === false) {
             $self->timer = Timer::builder()->setNewTimer(true)->setId(Uuid::uuid4()->__toString())->setInitialDate($self->initialExpiration)->setRepeatInterval($self->intervalDuration)->setInfo($self->info)->setPersistent($self->persistent)->setTimerState(TimerState::CREATED)->setTimedObjectId($self->timerService->getTimedObjectInvoker()->getTimedObjectId())->build($self->timerService);
             // we're dispatched now
             $self->dispatched = true;
         }
     }, $this);
     // profile the size of the sessions
     if ($this->profileLogger) {
         $this->profileLogger->debug(sprintf('Size of session pool is: %d', sizeof($this->sessionPool)));
     }
 }