Class FilesSupport.PathHolder

java.lang.Object
org.terracotta.utilities.io.FilesSupport.PathHolder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
FilesSupport

private static class FilesSupport.PathHolder extends Object implements AutoCloseable
Support class to open or lock a file for file operation impact assessment.

Although this class has "support" for opening a directory, there appears to be no reliable means in Java of opening a directory and observing the impact on other file operations.

  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • thread

      private final Thread thread
    • barrier

      private final Phaser barrier
    • started

      private final AtomicBoolean started
  • Constructor Details

  • Method Details

    • holdFile

      private void holdFile(Path file)
      Holds open a file for read.
      Parameters:
      file - the file path to hold open
    • lockFile

      private void lockFile(Path file)
      Holds a lock on a file.
      Parameters:
      file - the file path to lock
    • holdDirectory

      private void holdDirectory(Path dir)
    • start

      public void start()
      Open or lock the file and return. The file remains opened or locked until close() is called.
    • close

      public void close()
      Closes and unlocks the file.
      Specified by:
      close in interface AutoCloseable