Github user jaredjstewart commented on a diff in the pull request:

    https://github.com/apache/geode/pull/699#discussion_r132585334
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/internal/process/LocalProcessLauncher.java
 ---
    @@ -96,33 +117,55 @@ void close() {
        * @throws IOException if unable to create or write to the file
        */
       private void writePid(final boolean force) throws 
FileAlreadyExistsException, IOException {
    -    final boolean created = this.pidFile.createNewFile();
    -    if (!created && !force) {
    -      int otherPid = 0;
    -      try {
    -        otherPid = ProcessUtils.readPid(this.pidFile);
    -      } catch (IOException e) {
    -        // suppress
    -      } catch (NumberFormatException e) {
    -        // suppress
    -      }
    -      boolean ignorePidFile = false;
    -      if (otherPid != 0 && !ignoreIsPidAlive()) {
    -        ignorePidFile = !ProcessUtils.isProcessAlive(otherPid);
    -      }
    -      if (!ignorePidFile) {
    -        throw new FileAlreadyExistsException("Pid file already exists: " + 
this.pidFile + " for "
    -            + (otherPid > 0 ? "process " + otherPid : "unknown process"));
    +    if (this.pidFile.exists()) {
    +      if (!force) {
    +        checkOtherPid(readOtherPid());
           }
    +      this.pidFile.delete();
    +    }
    +
    +    assert !this.pidFile.exists();
    --- End diff --
    
    I saw that you used Apache common's `Validate` class in other places.  
Would that be good to use here since the default java `assert` won't do 
anything under normal circumstances?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to