/** * 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); }
static boolean kill2(int pid) { if (pureMode) { throw new RuntimeException(LocalizedStrings.OSProcess_KILL_NOT_ALLOWED_IN_PURE_JAVA_MODE.toLocalizedString()); } else { checkPid(pid); return _kill(pid); } } static private native boolean _kill(int 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);
/** * 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); }
/** * Terminate a process without warning and without a chance of an * orderly shutdown. This method should only be used as a last resort. * The {@link #shutdown(int)} method should be used in most cases. * @param pid the id of the process to kill * @return true if the process was killed; * false if it does not exist or can not be killed. */ static public boolean kill(int pid) { if (pureMode) { throw new RuntimeException(LocalizedStrings.OSProcess_KILL_NOT_ALLOWED_IN_PURE_JAVA_MODE.toLocalizedString()); } else { checkPid(pid); return _kill(pid); } } static private native boolean _kill(int 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);
/** * 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); }
} else { if (pid < 0) checkPid(pid); return _printStacks(pid);
} else { if (pid < 0) checkPid(pid); return _printStacks(pid);