Package 

Class CoroutineQueue


  • 
    public final class CoroutineQueue
    
                        

    CoroutineScope-like util to execute coroutines in a sequential order (FIFO). As with a SupervisorJob, children can be cancelled or fail independently one from the other.

    • Constructor Summary

      Constructors 
      Constructor Description
      CoroutineQueue(CoroutineDispatcher dispatcher)
    • Method Summary

      Modifier and Type Method Description
      final Unit launch(SuspendFunction0<Unit> block) Launches a coroutine in the queue.
      final <T extends Any> Deferred<T> async(SuspendFunction0<T> block) Creates a coroutine in the queue and returns its future result as an implementation of Deferred.
      final <T extends Any> T await(SuspendFunction0<T> block) Launches a coroutine in the queue, and waits for its result.
      final Unit )>cancel(<ERROR CLASS> cause) Cancels this coroutine queue, including all its children with an optional cancellation cause.
      • Methods inherited from class java.lang.Object

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

      • CoroutineQueue

        CoroutineQueue(CoroutineDispatcher dispatcher)
    • Method Detail

      • async

         final <T extends Any> Deferred<T> async(SuspendFunction0<T> block)

        Creates a coroutine in the queue and returns its future result as an implementation of Deferred.

        Exceptions thrown by block will be caught and represented in the resulting Deferred.

      • await

         final <T extends Any> T await(SuspendFunction0<T> block)

        Launches a coroutine in the queue, and waits for its result.

        Exceptions thrown by block will be rethrown.

      • cancel

         final Unit )>cancel(<ERROR CLASS> cause)

        Cancels this coroutine queue, including all its children with an optional cancellation cause.