*
* @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
*
// 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
+ $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. ---');
+ 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 ($handlerInstance->hasTasksLeft()) {
+ /*
+ * ----------------------------- 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. ---');
}
/**
// Add bootstrap filters
$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('cruncher_bootstrap_task_handler_initializer_filter'));
- //$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_generate_hubid_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('hub_shutdown_task_handler_filter'));
+ //$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_task_handler_filter'));
- // This is the last generic filter
- $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_cruncher_filter'));
+ // This is the last generic shutdown filter
+ $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_filter'));
}
}