You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2018/06/27 14:59:45 UTC
[geode] branch develop updated: GEODE-5346: Fix race in
LauncherLifecycleCommandsDUnitTest (#2080)
This is an automated email from the ASF dual-hosted git repository.
jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 6ae3cad GEODE-5346: Fix race in LauncherLifecycleCommandsDUnitTest (#2080)
6ae3cad is described below
commit 6ae3cada594be0a577b34c995bbc2f1f58a66c78
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Wed Jun 27 07:59:39 2018 -0700
GEODE-5346: Fix race in LauncherLifecycleCommandsDUnitTest (#2080)
---
.../LauncherLifecycleCommandsDUnitTest.java | 50 +++++++++++-----------
1 file changed, 24 insertions(+), 26 deletions(-)
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
index e6e6a3a..d5277b8 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
@@ -184,7 +184,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
assertEquals(expectedStatus.getJavaVersion(), actualStatus.getJavaVersion());
}
- protected Integer readPid(final File workingDirectory) throws IOException {
+ protected Integer readPid(final File workingDirectory) {
assertTrue(String.format("The working directory (%1$s) must exist!", workingDirectory),
workingDirectory != null && workingDirectory.isDirectory());
@@ -228,16 +228,18 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
}
protected Status stopLocator(final String workingDirectory) {
+ final Integer pid = readPid(new File(workingDirectory));
return waitForGemFireProcessToStop(
new Builder().setCommand(Command.STOP).setWorkingDirectory(workingDirectory).build().stop(),
- workingDirectory);
+ pid);
}
protected Status stopServer(final String workingDirectory) {
+ final Integer pid = readPid(new File(workingDirectory));
return waitForGemFireProcessToStop(
new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STOP)
.setWorkingDirectory(workingDirectory).build().stop(),
- workingDirectory);
+ pid);
}
protected String toString(final Result result) {
@@ -254,32 +256,28 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
}
protected Status waitForGemFireProcessToStop(final ServiceState serviceState,
- final String workingDirectory) {
+ final Integer pid) {
if (!Status.STOPPED.equals(serviceState.getStatus())) {
- try {
- final Integer pid = readPid(new File(workingDirectory));
-
- if (pid != null) {
- WaitCriterion waitCriteria = new WaitCriterion() {
- @Override
- public boolean done() {
- return !ProcessUtils.isProcessAlive(pid);
- }
-
- @Override
- public String description() {
- return String.format("Waiting for GemFire Process with PID (%1$d) to stop.", pid);
- }
- };
-
- waitForCriterion(waitCriteria, TimeUnit.SECONDS.toMillis(15),
- TimeUnit.SECONDS.toMillis(5), false);
-
- if (!waitCriteria.done()) {
- processIds.offer(pid);
+
+ if (pid != null) {
+ WaitCriterion waitCriteria = new WaitCriterion() {
+ @Override
+ public boolean done() {
+ return !ProcessUtils.isProcessAlive(pid);
+ }
+
+ @Override
+ public String description() {
+ return String.format("Waiting for GemFire Process with PID (%1$d) to stop.", pid);
}
+ };
+
+ waitForCriterion(waitCriteria, TimeUnit.SECONDS.toMillis(15),
+ TimeUnit.SECONDS.toMillis(5), false);
+
+ if (!waitCriteria.done()) {
+ processIds.offer(pid);
}
- } catch (IOException ignore) {
}
}