public int readPid() throws IOException {
    String pidValue = null;
    try (BufferedReader fileReader = new BufferedReader(new FileReader(pidFile))) {
      pidValue = fileReader.readLine();

      int pid = Integer.parseInt(pidValue);

      if (pid < 1) {
        throw new IllegalArgumentException(
            "Invalid pid '" + pid + "' found in " + pidFile.getCanonicalPath());
      }

      return pid;
    } catch (NumberFormatException ignored) {
      throw new IllegalArgumentException(
          "Invalid pid '" + pidValue + "' found in " + pidFile.getCanonicalPath());
    }
  }
Reads in the pid from the specified file.

@return the process id (pid) contained within the pidFile

@throws IllegalArgumentException if the pid in the pidFile is not a positive integer
@throws IOException if unable to read from the specified file
geode-core/src/main/java/org/apache/geode/internal/process/PidFile.java