+ // Get node instance
+ $nodeInstance = Registry::getRegistry()->getInstance('node');
+
+ // Add some node-specific filters, e.g. announcement
+ $nodeInstance->addExtraNodeFilters();
+
+ /*
+ * -------------------------- Hub activation --------------------------
+ * Activates the node by doing some final preparation steps and setting
+ * the attribute $hubIsActive to true
+ */
+ $nodeInstance->activateNode($requestInstance, $responseInstance);
+
+ // Get task handler instance
+ $handlerInstance = Registry::getRegistry()->getInstance('task');
+
+ // 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 hub is no longer active or all tasks are killed.
+ */
+ while (($nodeInstance->isNodeActive()) && ($handlerInstance->hasTasksLeft())) {
+ // Handle all tasks here
+ $handlerInstance->handleTasks();
+ } // END - while
+
+ // Debug message
+ $this->debugOutput('MAIN: --- Leaving main loop. ---');