private static Integer randomOrDefaultServerPort() { try { return Network.getFreeServerPort(); } catch (IOException e) { return 27017; } }
.net(new Net(LOCALHOST, port, Network.localhostIsIPv6())) // .cmdOptions(cmdOptions);
public static ProcessControl fromCommandLine(ISupportConfig runtime, List<String> commandLine, boolean redirectErrorStream) throws IOException { ProcessBuilder processBuilder = newProcessBuilder(commandLine, redirectErrorStream); return start(runtime, processBuilder); }
public Net() throws IOException { this(null, Network.getFreeServerPort(), Network.localhostIsIPv6()); }
public InetAddress getServerAddress() throws UnknownHostException { return Network.getLocalHost(); } }
public static int getFreeServerPort(InetAddress hostAddress) throws IOException { int ports[] = getFreeServerPorts(hostAddress, 10); return randomEntryOf(ports); }
public Executable(Distribution distribution, T config, RuntimeConfig runtimeConfig, ExtractedFileSet executable) { this.distribution = distribution; this.config = config; this.runtimeConfig = runtimeConfig; this.executable = executable; // only add shutdown hook for daemon processes, // clis being invoked will usually die by themselves if (runtimeConfig.isDaemonProcess()) { ProcessControl.addShutdownHook(new JobKiller()); registeredJobKiller = true; } }
public int waitFor() throws InterruptedException { return process.waitFor(); }
public boolean isProcessRunning() { if (getProcessId() > 0) { return Processes.isProcessRunning(distribution.getPlatform(), getProcessId()); } return false; }
protected final void stopProcess() { if (process != null) process.stop(); }
public int stop() { return waitForProcessGotKilled(); }
protected static MongodConfigBuilder createMongodConfigBuilder(int port) throws Exception { return new MongodConfigBuilder() .version(Version.Main.V2_4) .net(new Net(port, Network.localhostIsIPv6())); }
Integer[] defaultPortsIfRequired(Integer[] ports) { if (!ObjectUtils.isEmpty(ports)) { return ports; } try { return new Integer[] { Network.getFreeServerPort(), Network.getFreeServerPort(), Network.getFreeServerPort() }; } catch (IOException e) { throw new RuntimeException(e); } }
public static ProcessControl fromCommandLine(SupportConfig runtime, List<String> commandLine, boolean redirectErrorStream) throws IOException { ProcessBuilder processBuilder = newProcessBuilder(commandLine, redirectErrorStream); return start(runtime, processBuilder); }
public Executable(Distribution distribution, T config, IRuntimeConfig runtimeConfig, IExtractedFileSet executable) { this.distribution = distribution; this.config = config; this.runtimeConfig = runtimeConfig; this.executable = executable; // only add shutdown hook for daemon processes, // clis being invoked will usually die by themselves if (runtimeConfig.isDaemonProcess()) { ProcessControl.addShutdownHook(new JobKiller()); registeredJobKiller = true; } }
protected final void stopProcess() { if (process != null) process.stop(); }
.net(new Net(LOCALHOST, port, Network.localhostIsIPv6())) //
public Net() throws UnknownHostException, IOException { this(Network.getFreeServerPort()); }
public static boolean localhostIsIPv6() { try { return Network.localhostIsIPv6(); } catch (UnknownHostException e) { return false; } } }
public static boolean localhostIsIPv6() { try { return Network.localhostIsIPv6(); } catch (UnknownHostException e) { return false; } } }