]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/handler/tasks/class_TaskHandler.php
Network package writer added, shutdown refactured, fixes:
[hub.git] / application / hub / main / handler / tasks / class_TaskHandler.php
index a1ecf3016e48bf24e9a9012bcde467af43666fb1..f96df781e331f5bd361b3606501c53b9a36d65c2 100644 (file)
@@ -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;