io.vertx.core.file

## Interface AsyncFileLock

-     public interface AsyncFileLock

  A lock on a region of an `AsyncFile`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isShared()`
    `Future<Boolean>` | `isValid()` A lock remains valid until it is released or the file corresponding `AsyncFile` is closed.
    `void` | `isValid(Handler<AsyncResult<Boolean>> handler)` Like `isValid()` but the `handler` will be called when the operation completes or if an error occurs.
    `boolean` | `isValidBlocking()` Like `isValid()` but blocking.
    `boolean` | `overlaps(long position, long size)`
    `long` | `position()`
    `Future<Void>` | `release()` Releases this lock;
    `void` | `release(Handler<AsyncResult<Void>> handler)` Like `release()` but the `handler` will be called when the operation completes or if an error occurs.
    `void` | `releaseBlocking()` Like `release()` but blocking.
    `long` | `size()`

- - ### Method Detail

    - #### position

          long position()

      Returns:
        the position of the first byte of the locked region

    - #### size

          long size()

      Returns:
        the size in bytes of the locked region

    - #### isShared

          boolean isShared()

      Returns:
        `true` if this lock is shared, otherwise `false`

    - #### overlaps

          boolean overlaps(long position,
                           long size)

      Returns:
        `true` if this lock overlaps with the range described by `position` and `size`, otherwise `false`

    - #### isValidBlocking

          boolean isValidBlocking()

      Like `isValid()` but blocking.
      Throws:
        `FileSystemException` - if an error occurs

    - #### isValid

          Future<Boolean> isValid()

      A lock remains valid until it is released or the file corresponding `AsyncFile` is closed.

    - #### isValid

          void isValid(Handler<AsyncResult<Boolean>> handler)

      Like `isValid()` but the `handler` will be called when the operation completes or if an error occurs.

    - #### releaseBlocking

          void releaseBlocking()

      Like `release()` but blocking.
      Throws:
        `FileSystemException` - if an error occurs

    - #### release

          Future<Void> release()

      Releases this lock;

    - #### release

          void release(Handler<AsyncResult<Void>> handler)

      Like `release()` but the `handler` will be called when the operation completes or if an error occurs.

Copyright © 2023 Eclipse. All rights reserved.