private LocatorState createNoResponseState(final Exception cause, final String errorMessage) { debug(ExceptionUtils.getStackTrace(cause) + errorMessage); return new LocatorState(this, Status.NOT_RESPONDING, errorMessage); }
private LocatorState stopInProcess() { if (isStoppable()) { this.locator.stop(); this.locator = null; this.process.stop(this.deletePidFileOnStop); this.process = null; INSTANCE.compareAndSet(this, null); // note: other thread may return Status.NOT_RESPONDING now this.running.set(false); return new LocatorState(this, Status.STOPPED); } else { return new LocatorState(this, Status.NOT_RESPONDING); } }
try { LocatorStatusResponse response = statusLocator(getPort(), getBindAddress()); return new LocatorState(this, Status.ONLINE, response); } catch (Exception handled) { timedWait(interval, timeUnit); return new LocatorState(this, Status.NOT_RESPONDING);
running.set(true); return new LocatorState(this, Status.ONLINE); } catch (IOException e) { failOnStart(e);
debug( "Getting status from the LocatorLauncher instance that actually launched the GemFire Locator.%n"); return new LocatorState(this, Status.STARTING);
return stopWithWorkingDirectory(); } else { return new LocatorState(this, Status.NOT_RESPONDING);
return new LocatorState(this, Status.STOPPED); } catch (ConnectionFailedException handled) {
return new LocatorState(this, Status.STOPPED);
/** * Unmarshals a LocatorState instance from the JSON String. * * @return a LocatorState value unmarshalled from the JSON String. */ public static LocatorState fromJson(final String json) { try { final GfJsonObject gfJsonObject = new GfJsonObject(json); final Status status = Status.valueOfDescription(gfJsonObject.getString(JSON_STATUS)); final List<String> jvmArguments = Arrays.asList(GfJsonArray.toStringArray(gfJsonObject.getJSONArray(JSON_JVMARGUMENTS))); return new LocatorState(status, gfJsonObject.getString(JSON_STATUSMESSAGE), gfJsonObject.getLong(JSON_TIMESTAMP), gfJsonObject.getString(JSON_LOCATION), gfJsonObject.getInt(JSON_PID), gfJsonObject.getLong(JSON_UPTIME), gfJsonObject.getString(JSON_WORKINGDIRECTORY), jvmArguments, gfJsonObject.getString(JSON_CLASSPATH), gfJsonObject.getString(JSON_GEMFIREVERSION), gfJsonObject.getString(JSON_JAVAVERSION), gfJsonObject.getString(JSON_LOGFILE), gfJsonObject.getString(JSON_HOST), gfJsonObject.getString(JSON_PORT), gfJsonObject.getString(JSON_MEMBERNAME)); } catch (GfJsonException e) { throw new IllegalArgumentException( "Unable to create LocatorStatus from JSON: ".concat(json), e); } }
private LocatorState stopWithPid() { try { final ProcessController controller = new ProcessControllerFactory() .createProcessController(new LocatorControllerParameters(), getPid()); controller.checkPidSupport(); controller.stop(); return new LocatorState(this, Status.STOPPED); } catch (ConnectionFailedException handled) { // failed to attach to locator JVM return createNoResponseState(handled, "Failed to connect to locator with process id " + getPid()); } catch (IOException | MBeanInvocationFailedException | UnableToControlProcessException handled) { return createNoResponseState(handled, "Failed to communicate with locator with process id " + getPid()); } }
private LocatorState statusWithPort() { try { LocatorStatusResponse response = statusLocator(getPort(), getBindAddress()); return new LocatorState(this, Status.ONLINE, response); } catch (Exception handled) { return createNoResponseState(handled, "Failed to connect to locator " + getBindAddressAsString() + "[" + getPort() + "]"); } }
public static LocatorState fromDirectory(final String workingDirectory, final String memberName) { LocatorState locatorState = new LocatorLauncher.Builder().setWorkingDirectory(workingDirectory).build().status(); if (ObjectUtils.equals(locatorState.getMemberName(), memberName)) { return locatorState; } return new LocatorState(new LocatorLauncher.Builder().build(), Status.NOT_RESPONDING); }
private LocatorState statusInProcess() { if (this.starting.get()) { debug( "Getting status from the LocatorLauncher instance that actually launched the GemFire Locator.%n"); return new LocatorState(this, Status.STARTING); } else { debug("Getting Locator status using host (%1$s) and port (%2$s)%n", getBindAddressAsString(), getPortAsString()); return statusWithPort(); } }