]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/commands/console/class_HubConsoleCruncherCommand.php
Added DHT initialization task (see comments below):
[hub.git] / application / hub / main / commands / console / class_HubConsoleCruncherCommand.php
index 21743bd64dda5b8a22a9def37ef006268225e5cb..dd159a089ccd97b250064abf6204a0b8983825d0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright  Copyright (c) 2011 - 2012 Cruncher Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -61,37 +61,41 @@ class HubConsoleCruncherCommand extends BaseCommand implements Commandable {
                // Get a registry and the application instance from it
                $applicationInstance = Registry::getRegistry()->getInstance('app');
 
-               // ----------------------- Bootstrapping phase ------------------------
-               // Try to bootstrap the node and pass the request instance to it for
-               // extra arguments which mostly override config entries or enable special
-               // features within the hub (none is ready at this development stage)
-               $this->debugOutput('BOOTSTRAP: Beginning with bootstrap...');
+               /*
+                * ----------------------- Bootstrapping phase ------------------------
+                * Try to bootstrap the node and pass the request instance to it for
+                * extra arguments which mostly override config entries or enable special
+                * features within the hub (none is ready at this development stage)
+                */
+               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Beginning with bootstrap...');
                $applicationInstance->getControllerInstance()->executeBootstrapFilters($requestInstance, $responseInstance);
-               $this->debugOutput('BOOTSTRAP: Bootstrap finished.');
+               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Bootstrap finished.');
 
                // Get cruncher instance
                $cruncherInstance = Registry::getRegistry()->getInstance('cruncher');
 
-               // Add some cruncher-specific filters, e.g. announcement
+               // Add some cruncher-specific filters
                $cruncherInstance->addExtraCruncherFilters();
 
                // Get task handler instance
-               $handlerInstance = Registry::getRegistry()->getInstance('task');
+               $handlerInstance = Registry::getRegistry()->getInstance('task_handler');
 
                // Debug message
-               $this->debugOutput('MAIN: --- Entering main loop. ---');
-
-               // ----------------------------- Main loop ----------------------------
-               // This is the main loop. Queried calls should come back here very fast
-               // so the whole application runs on nice speed. This while-loop goes
-               // until the cruncher is no longer active or all tasks are killed.
-               while ($handlerInstance->hasTasksLeft()) {
+               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Entering main loop. ---');
+
+               /*
+                * ----------------------------- Main loop ----------------------------
+                * This is the main loop. Queried calls should come back here very fast
+                * so the whole application runs on nice speed. This while-loop goes
+                * until the cruncher is no longer active or all tasks are killed.
+                */
+               while (($cruncherInstance->isActive()) && ($handlerInstance->hasTasksLeft())) {
                        // Handle all tasks here
                        $handlerInstance->handleTasks();
                } // END - while
 
                // Debug message
-               $this->debugOutput('MAIN: --- Leaving main loop. ---');
+               self::createDebugInstance(__CLASS__)->debugOutput('MAIN: --- Leaving main loop. ---');
        }
 
        /**
@@ -110,13 +114,17 @@ class HubConsoleCruncherCommand extends BaseCommand implements Commandable {
 
                // Add bootstrap filters
                $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('cruncher_bootstrap_task_handler_initializer_filter'));
-               //$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('cruncher_bootstrap_generate_nodeid_filter'));
+               $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('cruncher_bootstrap_extra_bootstrapping_filter'));
+               $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('cruncher_bootstrap_buffer_queue_initializer_filter'));
+
+               // This is the last generic boostrap filter
+               $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('cruncher_bootstrap_generic_activation_filter'));
 
                // Add shutdown filters
                //$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_task_handler_filter'));
 
-               // This is the last generic filter
-               $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_cruncher_filter'));
+               // This is the last generic shutdown filter
+               $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_filter'));
        }
 }