/** * Gets information on the locator. * * @param directory the locator's directory * @return information string. * @throws UncreatedSystemException if the locator <code>directory</code> does not exist or is not * a directory. * @throws GemFireIOException if the manager info exists but could not be read. This probably * means that the info file is corrupt. */ public String locatorInfo(File directory) { int statusCode = ManagerInfo.getLocatorStatusCode(directory); String statusString = ManagerInfo.statusToString(statusCode); try { ManagerInfo mi = ManagerInfo.loadLocatorInfo(directory); if (statusCode == ManagerInfo.KILLED_STATUS_CODE) { return String.format("Locator in %s was killed while it was %s. Locator process id was %s.", directory, ManagerInfo.statusToString(mi.getManagerStatus()), Integer.valueOf(mi.getManagerProcessId())); } else { return String.format("Locator in %s is %s. Locator process id is %s.", directory, statusString, Integer.valueOf(mi.getManagerProcessId())); } } catch (UnstartedSystemException ex) { return String.format("Locator in %s is stopped.", directory); } catch (GemFireIOException ex) { return String.format("Locator in %s is starting.", directory); } }
private static boolean isManagerStopped(File directory, boolean locator) { try { ManagerInfo mi = loadManagerInfo(directory, locator); if (!OSProcess.exists(mi.getManagerProcessId())) { return true; } return false; } catch (UnstartedSystemException ignore) { return true; } 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; } } }
try { ManagerInfo info = ManagerInfo.loadLocatorInfo(directory); pid = info.getManagerProcessId(); if (portOption == null || portOption.trim().length() == 0) { port = info.getManagerPort();
try { ManagerInfo mi = ManagerInfo.loadManagerInfo(directory, locator); if (!PureJavaMode.isPure() && !OSProcess.exists(mi.getManagerProcessId())) { return KILLED_STATUS_CODE; } else {
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; } } }
if (!PureJavaMode.isPure() && !OSProcess.exists(mi.getManagerProcessId())) { return false;