geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jche...@apache.org
Subject incubator-geode git commit: GEODE-1387 CI Failure: LocatorLauncherRemoteFileIntegrationTest.testStatusUsingWorkingDirectory
Date Thu, 19 May 2016 16:55:43 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop aeb8c01df -> 21c0e24ee


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/develop
Commit: 21c0e24eed8b34088513a2ecc725e1a3dc71a2d8
Parents: aeb8c01
Author: Jianxia Chen <jchen@pivotal.io>
Authored: Thu May 19 09:52:50 2016 -0700
Committer: Jianxia Chen <jchen@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;
       }
     };
     


Mime
View raw message