You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/05/20 17:11:02 UTC
[37/50] [abbrv] incubator-geode git commit: GEODE-1387 CI Failure:
LocatorLauncherRemoteFileIntegrationTest.testStatusUsingWorkingDirectory
GEODE-1387 CI Failure: LocatorLauncherRemoteFileIntegrationTest.testStatusUsingWorkingDirectory
The locator status file writer and reader are out of sync. The reader
may read the empty file before writer writes to it. So write the status
to a temp file, then rename it. So that the reader reads the status file
that has content in it.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/21c0e24e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/21c0e24e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/21c0e24e
Branch: refs/heads/feature/GEODE-835
Commit: 21c0e24eed8b34088513a2ecc725e1a3dc71a2d8
Parents: aeb8c01
Author: Jianxia Chen <jc...@pivotal.io>
Authored: Thu May 19 09:52:50 2016 -0700
Committer: Jianxia Chen <jc...@pivotal.io>
Committed: Thu May 19 09:52:50 2016 -0700
----------------------------------------------------------------------
.../gemfire/internal/process/ControllableProcess.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/21c0e24e/geode-core/src/main/java/com/gemstone/gemfire/internal/process/ControllableProcess.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/process/ControllableProcess.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/process/ControllableProcess.java
index f459aed..f21930d 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/process/ControllableProcess.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/process/ControllableProcess.java
@@ -64,12 +64,18 @@ public final class ControllableProcess {
if (statusFile.exists()) {
statusFile.delete();
}
- boolean created = statusFile.createNewFile();
+ final File statusFileTmp = new File(workingDir, processType.getStatusFileName() + ".tmp");
+ if (statusFileTmp.exists()) {
+ statusFileTmp.delete();
+ }
+ boolean created = statusFileTmp.createNewFile();
assert created;
- final FileWriter writer = new FileWriter(statusFile);
+ final FileWriter writer = new FileWriter(statusFileTmp);
writer.write(state.toJson());
writer.flush();
writer.close();
+ boolean renamed = statusFileTmp.renameTo(statusFile);
+ assert renamed;
}
};