Class AsyncKt

  • All Implemented Interfaces:

    
    public final class AsyncKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static <T extends Any> T await(CompletableFuture<T> $self) Awaits for completion of this CompletableFuture without blocking a thread.
      final static <T extends Any> CompletableFuture<Result<T>> toResultFuture(CompletableFuture<T> $self) Converts a CompletableFuture<T> to a CompletableFuture<Result<T>>.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • await

         final static <T extends Any> T await(CompletableFuture<T> $self)

        Awaits for completion of this CompletableFuture without blocking a thread.

        This suspending function is cancellable. If the coroutine is cancelled while this function is suspended, the future will be cancelled as well.

        Returns:

        The result value of the CompletableFuture

      • toResultFuture

         final static <T extends Any> CompletableFuture<Result<T>> toResultFuture(CompletableFuture<T> $self)

        Converts a CompletableFuture<T> to a CompletableFuture<Result<T>>.

        This helper function wraps the result of a CompletableFuture in a Result, catching any exceptions and converting them to Result.failure().

        Uses libsignal's chaining mechanism to ensure proper bidirectional cancellation propagation for long async operations, like network requests.

        Returns:

        A new CompletableFuture that completes with Result.success(value) or Result.failure(exception)