private function removeTask(AsyncTask $task, $force = false) { $task->setGarbage(); if (isset($this->taskWorkers[$task->getTaskId()])) { if (!$force and ($task->isRunning() or !$task->isGarbage())) { return; } $this->workerUsage[$this->taskWorkers[$task->getTaskId()]]--; } unset($this->tasks[$task->getTaskId()]); unset($this->taskWorkers[$task->getTaskId()]); $task->cleanObject(); }
public function collectAsyncTask(AsyncTask $task) { if ($task->isFinished() and !$task->isGarbage()) { --$this->asyncTasks; $task->onCompletion(Server::getInstance()); $task->setGarbage(); unset($this->asyncTaskStorage[$task->getTaskId()]); } return $task->isGarbage(); }