public static void setLocatorStopping(File directory, int port, InetAddress bindAddress) { ManagerInfo.saveManagerInfo(OSProcess.getId(), STOPPING_STATUS_CODE, directory, port, bindAddress); } /**
/** * Tells a process to print its stacks to its standard output * @param pid the id of the process that will print its stacks, or zero for the current process * @return true if the process was told; * false if it does not exist or can not be told. */ static public boolean printStacks(int pid) { return printStacks(pid, false); }
protected boolean isExistingProcess(final int pid) { return (PureJavaMode.isPure() || (pid != 0 && OSProcess.exists(pid))); }
/** * Waits until the identified process exits. If the process does * not exist then returns immediately. */ static public void waitForPidToExit(int pid) { if (pureMode) { throw new RuntimeException(LocalizedStrings.OSProcess_WAITFORPIDTOEXIT_NOT_ALLOWED_IN_PURE_JAVA_MODE.toLocalizedString()); } checkPid(pid); waitForPid(pid); }
/** * Ask a process to shut itself down. * The process may catch and ignore this shutdown request. * @param pid the id of the process to shutdown * @return true if the request was sent to the process; * false if the process does not exist or can not be asked to shutdown. */ static public boolean shutdown(int pid) { if (pureMode) { throw new RuntimeException(LocalizedStrings.OSProcess_SHUTDOWN_NOT_ALLOWED_IN_PURE_JAVA_MODE.toLocalizedString()); } else { checkPid(pid); return _shutdown(pid); } } static private native boolean _shutdown(int pid);
public static PrintStream redirectOutput(File newOutput) throws IOException { return redirectOutput(newOutput, true); }
Status originalStatus = createStatus(this.baseName, STARTING, OSProcess.getId()); status = originalStatus; writeStatus(status); OSProcess.redirectOutput(system.getConfig().getLogFile());
/** * Find out if a process exists. * @param pid the id of the process to check for * @return true if the process exists; false if it does not. */ static boolean exists2(int pid) { if (pureMode) { throw new RuntimeException(LocalizedStrings.OSProcess_EXISTS_NOT_ALLOWED_IN_PURE_JAVA_MODE.toLocalizedString()); } checkPid(pid); if (reapPid(pid)) { try { pids.remove(Integer.valueOf(pid)); } catch (Exception ignore) {} String trace = System.getProperty("com.gemstone.gemfire.internal.OSProcess.trace"); if (trace != null && trace.length() > 0) { System.out.println("reaped pid: " + pid); } } return nativeExists(pid); }
for (int i=0; i<infos.length; i++) { if (i != thisThread && infos[i] != null) { formatThreadInfo(infos[i], sb); } else { if (pid < 0) checkPid(pid); return _printStacks(pid);
if (this.processorId > 0) { try { byte[] zippedStacks = OSProcess.zipStacks(); ReplyMessage.send(getSender(), processorId, zippedStacks, dm); } catch (IOException e) { OSProcess.printStacks(0, this.useNative);
private int runCommandLine(final Map<String, Object> options, final String[] commandLine) throws Exception { final File startLogFile = new File(workingDir, startLogFileName).getAbsoluteFile(); // see bug 32548 if (startLogFile.exists() && !startLogFile.delete()) { throw new IOException("Unable to delete start log file (" + startLogFile.getAbsolutePath() + ")!"); } Map<String, String> env = new HashMap<String, String>(); // read the passwords from command line SocketCreator.readSSLProperties(env); printCommandLine(commandLine); final int pid = OSProcess.bgexec(commandLine, workingDir, startLogFile, false, env); printStartMessage(options, pid); return pid; }
result = bgexecInternal(cmdarray, workdir.getPath(), logfile.getPath(), inheritLogfile);
/** * Redirects the standard out and standard err to the configured log file as specified in the GemFire distributed * system properties. * * @param distributedSystem the GemFire model for a distributed system. * @throws IOException if the standard out and err redirection was unsuccessful. */ protected void redirectOutput(final DistributedSystem distributedSystem) throws IOException { if (distributedSystem instanceof InternalDistributedSystem) { OSProcess.redirectOutput(((InternalDistributedSystem) distributedSystem).getConfig().getLogFile()); } }
/** * Find out if a process exists. * @param pid the id of the process to check for * @return true if the process exists; false if it does not. */ static public boolean exists(int pid) { if (pureMode) { throw new RuntimeException(LocalizedStrings.OSProcess_EXISTS_NOT_ALLOWED_IN_PURE_JAVA_MODE.toLocalizedString()); } checkPid(pid); if (reapPid(pid)) { try { pids.remove(Integer.valueOf(pid)); } catch (Exception ignore) {} String trace = System.getProperty("com.gemstone.gemfire.internal.OSProcess.trace"); if (trace != null && trace.length() > 0) { System.out.println("reaped pid: " + pid); } } return nativeExists(pid); }
for (int i=0; i<infos.length; i++) { if (i != thisThread && infos[i] != null) { formatThreadInfo(infos[i], sb); } else { if (pid < 0) checkPid(pid); return _printStacks(pid);
byte[] zippedStacks = OSProcess.zipStacks(); ReplyMessage.send(getSender(), processorId, zippedStacks, dm, null); } catch (IOException e) { OSProcess.printStacks(0, dm.getLoggerI18n().convertToLogWriter(), this.useNative);