org.apache.hadoop.hdfs.server.datanode.fsdataset

## 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

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Decrease the reference count of the volume.
    `FsVolumeSpi` | `getVolume()` Returns the underlying volume object.

- - ### Method Detail

    - #### 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.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.