private synchronized void cleanUp() {
    if (onCompletion == null) {
      return;
    }
    LOGGER.debug("{} cleaning up", this);
    onCompletion.run();
    onCompletion = null;
    LOGGER.debug("{} cleaned up", this);
  }
Wraps a Java {@link Process} to execute a completion function when it terminates.
build-tools/geode-testing-isolation/src/main/java/org/apache/geode/gradle/testing/isolation/CompletableProcess.java