Interface FsVolumeReference

All Superinterfaces:
AutoCloseable, Closeable

public interface FsVolumeReference extends Closeable
This holds volume reference count as AutoClosable resource. It increases the reference count by one in the constructor, and decreases the reference count by one in close().
  
    try (FsVolumeReference ref = volume.obtainReference()) {
      // Do IOs on the volume
      volume.createRwb(...);
      ...
    }
  
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Decrease the reference count of the volume.
    Returns the underlying volume object.
  • Method Details

    • close

      void close() throws IOException
      Decrease the reference count of the volume.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - it never throws IOException.
    • getVolume

      FsVolumeSpi getVolume()
      Returns the underlying volume object. Return null if the reference was released.