public EXECUTABLE prepare(CONFIG config) throws DistributionException{ return prepare(config, Distribution.detectFor(config.version())); }
public EXECUTABLE prepare(CONFIG config) { return prepare(config, Distribution.detectFor(config.version())); }
public static void startMongoDB() throws IOException { if (!started.compareAndSet(false, true)) { throw new RuntimeException("Embedded mongo already running, call stopMongoDB before starting it again!"); } final String bindIp = "localhost"; try { final int port = Network.getFreeServerPort(); final IMongodConfig mongodConfig = new MongodConfigBuilder() .version(Version.Main.PRODUCTION) .net(new Net(bindIp, port, Network.localhostIsIPv6())) .build(); final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder() .defaultsWithLogger(Command.MongoD, LOG) .build()); mongodExecutable = runtime.prepare(mongodConfig, Distribution.detectFor(Version.Main.PRODUCTION)); mongodProcess = mongodExecutable.start(); mongoClient = new MongoClient(bindIp, port); } catch (final IOException e) { stopMongoDB(); throw e; } }
try { int pid = getPidFromFile(pidFile); Platform platform = Distribution.detectFor(version) .getPlatform(); synchronized (MemcachedProcess.class) {
@Override protected final void onAfterProcessStart(ProcessControl process, IRuntimeConfig runtimeConfig) throws IOException { ProcessOutput outputConfig = runtimeConfig.getProcessOutput(); // memcached prints all status messages on error console, and only // if // started with -vv LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor( "server listening", knownFailureMessages(), StreamToLineProcessor.wrap(outputConfig.getError())); Processors.connect(process.getError(), logWatch); logWatch.waitForResult(getConfig().timeout().getStartupTimeout()); if (!logWatch.isInitWithSuccess()) { throw new IOException("Could not start process:" + logWatch.getOutput()); } if (Distribution.detectFor(getConfig().version()).getPlatform() == Platform.Windows) { // On windows, process won't be writing a pid file. Sigh. Use // some // force to find out the pid anyways. This works pretty well // on Unix // (won't help us much here..) and needs Sigar lib on Windows. setProcessId(process.getPid()); } else { setProcessId(getPidFromFile(pidFile())); } }