setTaskId() public method

public setTaskId ( $taskId )
 /**
  * Submits a asynchronous task to the Pool
  * If the AsyncTask sets a result, you have to get it so it can be deleted
  *
  * @param AsyncTask $task
  *
  * @return void
  */
 public function scheduleAsyncTask(AsyncTask $task)
 {
     $id = $this->nextId();
     $task->setTaskId($id);
     $this->asyncPool->submit($task);
     $this->asyncTaskStorage[$id] = $task;
     ++$this->asyncTasks;
 }
Example #2
0
 /**
  * Submits an asynchronous task to a specific Worker in the Pool
  *
  * @param AsyncTask $task
  * @param int       $worker
  *
  * @return void
  */
 public function scheduleAsyncTaskToWorker(AsyncTask $task, $worker)
 {
     $id = $this->nextId();
     $task->setTaskId($id);
     $this->asyncPool->submitTaskToWorker($task, $worker);
 }
 /**
  * Submits an asynchronous task to the Worker Pool
  *
  * @param AsyncTask $task
  *
  * @return void
  */
 public function scheduleAsyncTask(AsyncTask $task)
 {
     $id = $this->nextId();
     $task->setTaskId($id);
     $this->asyncPool->submitTask($task);
 }
 /**
  * Submits an asynchronous task to a specific Worker in the Pool
  *
  * @param AsyncTask $task
  * @param int       $worker
  *
  * @return void
  */
 public function scheduleAsyncTaskToWorker(AsyncTask $task, $worker)
 {
     if ($task->getTaskId() !== null) {
         throw new \UnexpectedValueException("Attempt to schedule the same AsyncTask instance twice");
     }
     $id = $this->nextId();
     $task->setTaskId($id);
     $task->progressUpdates = new \Threaded();
     $this->asyncPool->submitTaskToWorker($task, $worker);
 }