Class AsyncFileLock

java.lang.Object
io.vertx.mutiny.core.file.AsyncFileLock
All Implemented Interfaces:
MutinyDelegate

public class AsyncFileLock extends Object implements MutinyDelegate
A lock on a region of an AsyncFile.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

See Also:
  • AsyncFileLock
  • Field Details

  • Constructor Details

    • AsyncFileLock

      public AsyncFileLock(io.vertx.core.file.AsyncFileLock delegate)
      Create a new instance of AsyncFileLock delegating to the given (non-null) instance of AsyncFileLock.
    • AsyncFileLock

      public AsyncFileLock(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.core.file.AsyncFileLock getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • isValid

      @CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> isValid()
      A lock remains valid until it is released or the file corresponding AsyncFile is closed.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • AsyncFileLock.isValid()
    • isValidAndAwait

      public Boolean isValidAndAwait()
      A lock remains valid until it is released or the file corresponding AsyncFile is closed.

      Unlike the bare Vert.x variant, this method returns a Boolean. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Returns:
      The operation result
      See Also:
      • AsyncFileLock.isValid()
    • isValidAndForget

      public AsyncFileLock isValidAndForget()
      A lock remains valid until it is released or the file corresponding AsyncFile is closed.

      Unlike the bare Vert.x variant, this method ignores the Boolean result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • AsyncFileLock.isValid()
    • release

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> release()
      Releases this lock;

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • AsyncFileLock.release()
    • releaseAndAwait

      public void releaseAndAwait()
      Releases this lock;

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • AsyncFileLock.release()
    • releaseAndForget

      public AsyncFileLock releaseAndForget()
      Releases this lock;

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • AsyncFileLock.release()
    • position

      public long position()
      Returns:
      the position of the first byte of the locked region
    • size

      public long size()
      Returns:
      the size in bytes of the locked region
    • isShared

      public boolean isShared()
      Returns:
      true if this lock is shared, otherwise false
    • overlaps

      public boolean overlaps(long position, long size)
      Returns:
      true if this lock overlaps with the range described by position and size, otherwise false
    • isValidBlocking

      public boolean isValidBlocking()
      Like isValid() but blocking.
    • releaseBlocking

      public void releaseBlocking()
      Like release() but blocking.
    • newInstance

      public static AsyncFileLock newInstance(io.vertx.core.file.AsyncFileLock delegate)
      Creates a new instance of the AsyncFileLock.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object