You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ja...@apache.org on 2018/11/14 19:28:47 UTC

[geode] branch develop updated: GEODE-5228: Test will now retry status call to check status of server (#2839)

This is an automated email from the ASF dual-hosted git repository.

jasonhuynh 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 c1f102d  GEODE-5228: Test will now retry status call to check status of server (#2839)
c1f102d is described below

commit c1f102d226f75ae972e67f111fe1365e8862baf9
Author: Jason Huynh <hu...@gmail.com>
AuthorDate: Wed Nov 14 11:28:39 2018 -0800

    GEODE-5228: Test will now retry status call to check status of server (#2839)
    
    *  There is a race condition where checking status will read the existing
         status file (created by the test).
---
 .../org/apache/geode/internal/process/ControlFileWatchdog.java     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/process/ControlFileWatchdog.java b/geode-core/src/main/java/org/apache/geode/internal/process/ControlFileWatchdog.java
index 681f607..157b360 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/process/ControlFileWatchdog.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/process/ControlFileWatchdog.java
@@ -59,6 +59,7 @@ class ControlFileWatchdog implements Runnable {
   @Override
   public void run() {
     try { // always set alive before stopping
+      deleteExistingStatusResponseFile();
       while (isAlive()) {
         doWork();
       }
@@ -69,6 +70,12 @@ class ControlFileWatchdog implements Runnable {
     }
   }
 
+  private void deleteExistingStatusResponseFile() throws IllegalStateException {
+    if (!file.delete() && file.exists()) {
+      throw new IllegalStateException("Unable delete file: " + file);
+    }
+  }
+
   private void doWork() {
     try { // handle handle exceptions
       if (file.exists()) {