public static String getLocatorStatusCodeString(File directory) { return statusToString(getLocatorStatusCode(directory)); }
/** * Cleans up any artifacts left by a killed locator. Namely the info file is deleted. */ private static void cleanupAfterKilledLocator(File directory) { try { if (ManagerInfo.getLocatorStatusCode(directory) == ManagerInfo.KILLED_STATUS_CODE) { File infoFile = ManagerInfo.getLocatorInfoFile(directory); if (infoFile.exists()) { if (!infoFile.delete() && infoFile.exists()) { System.out.println("WARNING: unable to delete " + infoFile.getAbsolutePath()); } if (!quiet) { System.out.println( "Cleaned up artifacts left by the previous killed locator."); } } } } catch (GemFireException ignore) { } }
/** * 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); } }