From: Roland Haeder Date: Sat, 7 Mar 2015 18:04:42 +0000 (+0100) Subject: Register the task handler after it has been created as some tasks may need it X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=97eb9507f2d0fdcd7668009b349ea622374fb972;p=hub.git Register the task handler after it has been created as some tasks may need it during initialization phase. Signed-off-by: Roland Haeder --- diff --git a/application/hub/main/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php index a39575967..17e808a62 100644 --- a/application/hub/main/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/apt-proxy/class_AptProxyTaskHandlerInitializerFilter.php @@ -61,6 +61,9 @@ class AptProxyTaskHandlerInitializerFilter extends BaseAptProxyFilter implements // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + // Put the task handler in registry + Registry::getRegistry()->addInstance('task_handler', $handlerInstance); + /* * Register all tasks: * @@ -68,9 +71,6 @@ class AptProxyTaskHandlerInitializerFilter extends BaseAptProxyFilter implements */ $taskInstance = ObjectFactory::createObjectByConfiguredName('apt_proxy_listener_task_class'); $handlerInstance->registerTask('apt_proxy_listener', $taskInstance); - - // Put the task handler in registry - Registry::getRegistry()->addInstance('task_handler', $handlerInstance); } } diff --git a/application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php index 178f70743..85db533fb 100644 --- a/application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php @@ -61,6 +61,9 @@ class ChatTaskHandlerInitializerFilter extends BaseChatFilter implements Filtera // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + // Put the task handler in registry + Registry::getRegistry()->addInstance('task_handler', $handlerInstance); + /* * Register all tasks: * @@ -68,9 +71,6 @@ class ChatTaskHandlerInitializerFilter extends BaseChatFilter implements Filtera */ $taskInstance = ObjectFactory::createObjectByConfiguredName('chat_telnet_listener_task_class'); $handlerInstance->registerTask('chat_telnet_listener', $taskInstance); - - // Put the task handler in registry - Registry::getRegistry()->addInstance('task_handler', $handlerInstance); } } diff --git a/application/hub/main/filter/task/crawler/class_CrawlerTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/crawler/class_CrawlerTaskHandlerInitializerFilter.php index d5af2cc51..1a5ee9eb7 100644 --- a/application/hub/main/filter/task/crawler/class_CrawlerTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/crawler/class_CrawlerTaskHandlerInitializerFilter.php @@ -61,6 +61,9 @@ class CrawlerTaskHandlerInitializerFilter extends BaseCrawlerFilter implements F // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + // Put the task handler in registry + Registry::getRegistry()->addInstance('task_handler', $handlerInstance); + /* * Register all tasks: * @@ -113,9 +116,6 @@ class CrawlerTaskHandlerInitializerFilter extends BaseCrawlerFilter implements F // 11) Uploaded list scanner (checks for wanted files) $taskInstance = ObjectFactory::createObjectByConfiguredName('crawler_uploaded_list_scanner_task_class'); $handlerInstance->registerTask('crawler_uploaded_list_scanner', $taskInstance); - - // Put the task handler in registry - Registry::getRegistry()->addInstance('task_handler', $handlerInstance); } } diff --git a/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php index 0b49446e9..2d0095ec2 100644 --- a/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/cruncher/class_CruncherTaskHandlerInitializerFilter.php @@ -61,6 +61,9 @@ class CruncherTaskHandlerInitializerFilter extends BaseCruncherFilter implements // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + // Put the task handler in registry + Registry::getRegistry()->addInstance('task_handler', $handlerInstance); + // Register all tasks: // // 1) A task for fetching WUs (work units) or test units @@ -82,9 +85,6 @@ class CruncherTaskHandlerInitializerFilter extends BaseCruncherFilter implements */ $taskInstance = ObjectFactory::createObjectByConfiguredName('cruncher_key_producer_task_class'); $handlerInstance->registerTask('cruncher_key_producer', $taskInstance); - - // Put the task handler in registry - Registry::getRegistry()->addInstance('task_handler', $handlerInstance); } } diff --git a/application/hub/main/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php index fefaf3c1e..742b40be4 100644 --- a/application/hub/main/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/miner/class_MinerTaskHandlerInitializerFilter.php @@ -61,6 +61,9 @@ class MinerTaskHandlerInitializerFilter extends BaseMinerFilter implements Filte // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + // Put the task handler in registry + Registry::getRegistry()->addInstance('task_handler', $handlerInstance); + // Register all tasks: // // 1) A task for fetching blocks from the network @@ -82,9 +85,6 @@ class MinerTaskHandlerInitializerFilter extends BaseMinerFilter implements Filte */ $taskInstance = ObjectFactory::createObjectByConfiguredName('miner_node_communicator_task_class'); $handlerInstance->registerTask('miner_node_communicator', $taskInstance); - - // Put the task handler in registry - Registry::getRegistry()->addInstance('task_handler', $handlerInstance); } } diff --git a/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php index 631ba9384..abc35dc35 100644 --- a/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php @@ -61,6 +61,9 @@ class NodeTaskHandlerInitializerFilter extends BaseNodeFilter implements Filtera // Get a new task handler instance $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + // Put the task handler in registry + Registry::getRegistry()->addInstance('task_handler', $handlerInstance); + // Prepare a package-tags initialization task for the listeners $taskInstance = ObjectFactory::createObjectByConfiguredName('node_package_tags_init_task_class'); @@ -142,9 +145,6 @@ class NodeTaskHandlerInitializerFilter extends BaseNodeFilter implements Filtera // Register it $handlerInstance->registerTask('ping', $taskInstance); - // Put the task handler in registry - Registry::getRegistry()->addInstance('task_handler', $handlerInstance); - /* * Allow extra node-depending tasks, e.g. the bootstrapper node needs * booting its DHT. DHTs are decentralized and are working on