/** * Return command used to start the standalone server. * * @return string */ public function getCommand() { $port = $this->config->getPort(); $java_bin = $this->config->getJavaBin(); $jars = []; $classpaths = $this->config->getClasspaths(); foreach ($classpaths as $classpath) { if (preg_match('/\\*\\.jar$/', $classpath)) { $directory = preg_replace('/\\*\\.jar$/', '', $classpath); $files = glob("{$directory}/*.jar"); foreach ($files as $file) { foreach ($files as $file) { $jars[] = $file; } } } else { $jars[] = $classpath; } } $jars[] = $this->config->getServerJar(); $classpath = implode(':', $jars); $threads = $this->config->getThreads(); $directives = ' -D' . implode(' -D', ['php.java.bridge.daemon="false"', "php.java.bridge.threads={$threads}"]); $command = sprintf('%s -cp "%s" %s php.java.bridge.Standalone SERVLET:%d', $java_bin, $classpath, $directives, $port); return $command; }
public function testThreadsDefault() { $config = PjbServerTestConfig::getStandaloneServerConfig()->getConfig(); unset($config['threads']); $cfg = new Config($config); $this->assertEquals(50, $cfg->getThreads()); }