Query whether the application server should keep running or not.
public keepRunning ( ) : boolean | ||
return | boolean | TRUE if the server should keep running, else FALSE |
$namingDirectory->createSubdirectory('php:env/args'); $namingDirectory->createSubdirectory('php:global'); $namingDirectory->createSubdirectory('php:global/log'); $namingDirectory->createSubdirectory('php:services'); // create the default subdirectories foreach (array_keys(ApplicationServer::$runlevels) as $runlevel) { $namingDirectory->createSubdirectory(sprintf('php:services/%s', $runlevel)); } // bind the command line arguments to the naming directory foreach ($arguments as $name => $value) { $namingDirectory->bind(sprintf('php:env/args/%s', $name), empty($value) ? true : $value); } // bind the current user to the naming directory $namingDirectory->bind('php:env/currentUser', isset($_SERVER['SUDO_USER']) ? $_SERVER['SUDO_USER'] : get_current_user()); // bind the path to the default configuration and bootstrap filenames $namingDirectory->bind('php:env/configurationFilename', DirectoryKeys::realpath($filename)); $namingDirectory->bind('php:env/bootstrapConfigurationFilename', DirectoryKeys::realpath($bootstrapFilename)); // add the storeage containers for the runlevels $runlevels = new GenericStackable(); foreach (ApplicationServer::$runlevels as $runlevel) { $runlevels[$runlevel] = new GenericStackable(); } // initialize and start the application server $applicationServer = new ApplicationServer($namingDirectory, $runlevels); $applicationServer->start(); // we've to wait for shutdown while ($applicationServer->keepRunning()) { sleep(1); } // wait until all threads have been stopped $applicationServer->join();