X-Git-Url: https://git.mxchange.org/?p=hub.git;a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fhandler%2Ftasks%2Fclass_TaskHandler.php;h=f96df781e331f5bd361b3606501c53b9a36d65c2;hp=a1ecf3016e48bf24e9a9012bcde467af43666fb1;hb=f7e3ad3f9e2322a6a8837409038c151bec2094f5;hpb=22079aa7f39f3cbdf0eb62980b4a36810451eea6 diff --git a/application/hub/main/handler/tasks/class_TaskHandler.php b/application/hub/main/handler/tasks/class_TaskHandler.php index a1ecf3016..f96df781e 100644 --- a/application/hub/main/handler/tasks/class_TaskHandler.php +++ b/application/hub/main/handler/tasks/class_TaskHandler.php @@ -154,12 +154,18 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { /** * Unregisters the given task * - * @param $taskName Name of the task + * @param $taskData Data of the task * @return void */ - private function unregisterTask ($taskName) { + private function unregisterTask (array $taskData) { + // Debug output + $this->debugOutput('TASK-HANDLER: Removing task ' . $taskData['id'] . ' from queue - START'); + // Remove the entry - $this->getListInstance()->removeEntry('tasks', $taskName); + $this->getListInstance()->removeEntry('tasks', $taskData); + + // Debug output + $this->debugOutput('TASK-HANDLER: Removing task ' . $taskData['id'] . ' from queue - FINISHED'); } /** @@ -262,6 +268,9 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Remember all tasks that has been shutdown for removal $tasks = array(); + // Instance a visitor + $this->visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_task_visitor_class'); + // Shutdown all tasks in once go while ($this->getIteratorInstance()->valid()) { // Get current entry @@ -271,7 +280,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { $this->debugOutput('TASK-HANDLER: Shutting down task ' . $current['id'] . ' (taskInstance=' . $current['task_instance']->__toString() . ') ...'); // Shutdown the task - $current['task_instance']->doShutdown(); + $current['task_instance']->accept($this->visitorInstance); // Remember this task $tasks[] = $current;