protected boolean isExistingProcess(final int pid) { return (PureJavaMode.isPure() || (pid != 0 && OSProcess.exists(pid))); }
/** * A wrapper method for the readStatus method to make one last check for the GemFire JMX Agent process if running * with the native libraries. * @return the Status object as returned from readStatus unless running in native mode and a determination is made * such that the Agent process is not running. * @throws IOException if the state of the Agent process could not be read from the .agent.ser status file. * @see #readStatus() */ protected Status nativeReadStatus() throws IOException { Status status = readStatus(); // @see Bug #32760 - the bug is still possible in pure Java mode if (status != null && !PureJavaMode.isPure() && !OSProcess.exists(status.pid)) { status = createStatus(status, SHUTDOWN); } return status; }
public void testMemberId() throws UnknownHostException { String host = SocketCreator.getLocalHost().getCanonicalHostName(); String name = "Foo"; Properties cfg = new Properties(); cfg.setProperty("mcast-port", "0"); cfg.setProperty("locators", ""); cfg.setProperty(DistributionConfig.NAME_NAME, name); DistributedSystem ds = DistributedSystem.connect(cfg); System.out.println("MemberId = " + ds.getMemberId()); assertEquals(host.toString(), ds.getDistributedMember().getHost()); assertEquals(OSProcess.getId(), ds.getDistributedMember().getProcessId()); if(!PureJavaMode.isPure()) { String pid = String.valueOf(OSProcess.getId()); assertTrue(ds.getMemberId().indexOf(pid) > -1); } assertTrue(ds.getMemberId().indexOf(name) > -1); String memberid = ds.getMemberId(); String shortname = shortName(host); assertTrue("'" + memberid + "' does not contain '" + shortname + "'", memberid.indexOf(shortname) > -1); }
boolean treatAsPure = (env.size() > 0) || PureJavaMode.isPure();
boolean treatAsPure = (env.size() > 0) || PureJavaMode.isPure();
try { ManagerInfo mi = ManagerInfo.loadManagerInfo(directory, locator); if (!PureJavaMode.isPure() && !OSProcess.exists(mi.getManagerProcessId())) { return KILLED_STATUS_CODE; } else {
try { ManagerInfo mi = ManagerInfo.loadManagerInfo(directory, locator); if (!PureJavaMode.isPure() && !OSProcess.exists(mi.getManagerProcessId())) { return KILLED_STATUS_CODE; } else {
public void testCacheServerTerminatingAbnormally() throws Exception { if (!PureJavaMode.isPure()) { final String testCaseName = "testCacheServerTerminatingAbnormally"; final File cacheServerDirectory = new File("CacheServerLauncherJUnitTest_" + testCaseName);
if (!PureJavaMode.isPure() && !OSProcess.exists(mi.getManagerProcessId())) { return false;
private static boolean isManagerStarted(File directory, boolean locator) { try { ManagerInfo mi = loadManagerInfo(directory, locator); int status = mi.getManagerStatus(); if (status != STARTED_STATUS_CODE) { return false; } // Check to see if manager process exists, assume it is for PureJava if (PureJavaMode.isPure() || OSProcess.exists(mi.getManagerProcessId())) { return true; } return false; } catch (UnstartedSystemException ignore) { return false; } catch (GemFireIOException ex) { Throwable cause = ex.getCause(); if (cause == null) { // this happens when the file was zero size return false; } else if (cause instanceof InvalidClassException) { // This happens when we have a serialVersionUID mismatch. // We don't want to hide this so throw the exception throw ex; } else { return false; } } } public static boolean isLocatorRunning(File directory) {
private static boolean isManagerStarted(File directory, boolean locator) { try { ManagerInfo mi = loadManagerInfo(directory, locator); int status = mi.getManagerStatus(); if (status != STARTED_STATUS_CODE) { return false; } // Check to see if manager process exists, assume it is for PureJava if (PureJavaMode.isPure() || OSProcess.exists(mi.getManagerProcessId())) { return true; } return false; } catch (UnstartedSystemException ignore) { return false; } catch (GemFireIOException ex) { Throwable cause = ex.getCause(); if (cause == null) { // this happens when the file was zero size return false; } else if (cause instanceof InvalidClassException) { // This happens when we have a serialVersionUID mismatch. // We don't want to hide this so throw the exception throw ex; } else { return false; } } } public static boolean isLocatorRunning(File directory) {
if (!PureJavaMode.isPure() && !OSProcess.exists(mi.getManagerProcessId())) { return false;
HashSet hs = (HashSet) rel.createSet.get(Region.SEPARATOR + prPrefix); assertNotNull(hs); if(!PureJavaMode.isPure()) { String s = hs.toString(); assertTrue("vm1pid " + vm1pid + " not found in createSet: " + s, s.indexOf(Integer.toString(vm1pid)) > -1);