示例#1
0
 public function addTaskHigh($function_name, $workload, &$context = null, $unique = null)
 {
     $function_name = $this->_processFunctionName($function_name);
     return parent::addTaskHigh($function_name, $workload, $context, $unique);
 }
示例#2
0
 /**
  * Executes an asynchronous request using the driver
  * method.
  * 
  *      // Execute the asynchronous request
  *      $driver->execute($request_async);
  *
  * @param   Request_Async   The asynchronous request to execute
  * @return  Request_Async
  */
 public function execute(Request_Async $request_async)
 {
     // Assign the asynchronous request to this driver
     $this->_request_async = $request_async;
     // Foreach request
     foreach ($request_async as $request) {
         // Add the task to the job
         $task = $this->_gearman_client->addTaskHigh('request_async', serialize($request), Request_Async_Gearman::$context);
         $uuid = $task->unique();
         $this->_requests[$uuid] = $request;
         $this->_task_handles[] = $task;
         $this->_complete[$uuid] = NULL;
     }
     // Run the tasks
     $this->_gearman_client->runTasks();
     // Return request async object
     return $request_async;
 }