public void countDown() throws IOException {
    try (FileOutputStream out = new FileOutputStream(lockFile)) {
      java.nio.channels.FileLock lock = out.getChannel().lock();

      try {
        String fileContents = FileUtils.readFileToString(dataFile, Charsets.UTF_8);
        int currentValue = Integer.parseInt(fileContents);

        int newValue = currentValue - 1;
        FileUtils.writeStringToFile(dataFile, String.valueOf(newValue), Charsets.UTF_8);

      } finally {
        lock.release();
      }
    }
  }
This is an implementation of CountDownLatch that can be serialized and used across multiple DUnit
VMs. File locks are used to synchronize between the separate VMs. For an example usage, see
ShowDeadlockDUnitTest.
geode-junit/src/main/java/org/apache/geode/test/concurrent/FileBasedCountDownLatch.java