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() + "]"); } }
private ServerState statusInProcess() { if (isStartingOrRunning()) { debug( "Getting status from the ServerLauncher instance that actually launched the GemFire Cache Server.%n"); return new ServerState(this, isRunning() ? Status.ONLINE : Status.STARTING); } else { return new ServerState(this, Status.NOT_RESPONDING); } }
@Override protected Properties getDistributedSystemProperties() { return super.getDistributedSystemProperties(getProperties()); }
public static ServerState fromDirectory(final String workingDirectory, final String memberName) { ServerState serverState = new ServerLauncher.Builder().setWorkingDirectory(workingDirectory) .setDisableDefaultServer(true).build().status(); if (ObjectUtils.equals(serverState.getMemberName(), memberName)) { return serverState; } return new ServerState(new ServerLauncher.Builder().build(), Status.NOT_RESPONDING); }
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); }
@Test public void serviceStateMarshalsToAndFromJsonWhenNotResponding() { launcher.setStatus(NOT_RESPONDING); TestLauncher.TestState status = launcher.status(); String json = status.toJson(); validateJson(status, json); validateStatus(status, TestLauncher.TestState.fromJson(json)); }
/** * Gets the String representation of this Server launcher command. * * @return a String value representing this Server launcher command. */ @Override public String toString() { return getName(); } }
@Override public void releaseTieLock() { if (holdingTieLock) { distributedLockService.unlock("PERSISTENCE_" + regionPath); holdingTieLock = false; } }
/** * Validates the Builder configuration settings and then constructs an instance of the * LocatorLauncher class to invoke operations on a GemFire Locator. * * @return a newly constructed instance of LocatorLauncher configured with this Builder. * @see #validate() * @see org.apache.geode.distributed.LocatorLauncher */ public LocatorLauncher build() { validate(); return new LocatorLauncher(this); } }
/** * Validates the Builder configuration settings and then constructs an instance of the * ServerLauncher class to invoke operations on a GemFire Server. * * @return a newly constructed instance of the ServerLauncher configured with this Builder. * @see #validate() * @see org.apache.geode.distributed.ServerLauncher */ public ServerLauncher build() { validate(); return new ServerLauncher(this); } }
/** * Examine the size of the collection of locators running in this VM * * @return the number of locators running in this VM * @deprecated as of 7.0 use {@link #hasLocator} instead. */ public static boolean hasLocators() { return hasLocator(); }
/** * Validates the arguments passed to the Builder when the 'status' command has been issued. * * @see org.apache.geode.distributed.LocatorLauncher.Command#STATUS */ protected void validateOnStatus() { if (Command.STATUS == getCommand()) { } }
/** * Creates a Properties object with configuration settings that the launcher has that should take * precedence over anything the user has defined in their gemfire properties file. * * @return a Properties object with GemFire properties that the launcher has defined. * @see #getDistributedSystemProperties(java.util.Properties) * @see java.util.Properties */ protected Properties getDistributedSystemProperties() { return getDistributedSystemProperties(null); }
private void validateJson(final TestLauncher.TestState expected, final String json) { TestLauncher.TestState actual = TestLauncher.TestState.fromJson(json); validateStatus(expected, actual); }
/** * Create a new LockServiceDestroyedException for this lock service. * * @param message the detail message that explains the exception * @return new LockServiceDestroyedException */ protected LockServiceDestroyedException generateLockServiceDestroyedException(String message) { return new LockServiceDestroyedException(message); }
@Override public void handleStop() { if (isStoppable()) { stopInProcess(); } }
/** * Asserts that the specified port is available on all network interfaces on this local system. * * @param port an integer indicating the network port to listen for client network requests. * @throws BindException if the network port is not available. */ protected static void assertPortAvailable(final int port) throws BindException { assertPortAvailable(null, port); }
@Test public void serviceStateMarshalsToAndFromJsonWhenStopped() { launcher.setStatus(STOPPED); TestLauncher.TestState status = launcher.status(); String json = status.toJson(); validateJson(status, json); validateStatus(status, TestLauncher.TestState.fromJson(json)); }
@Test public void serviceStateMarshalsToAndFromJsonWhenOnline() { launcher.setStatus(ONLINE); TestLauncher.TestState status = launcher.status(); String json = status.toJson(); validateJson(status, json); validateStatus(status, TestLauncher.TestState.fromJson(json)); }
@Test public void serviceStateMarshalsToAndFromJsonWhenStarting() { TestLauncher.TestState status = launcher.status(); String json = status.toJson(); validateJson(status, json); validateStatus(status, TestLauncher.TestState.fromJson(json)); }