Class CoroutineScope.ScopeFuture<T>

  • All Implemented Interfaces:
    java.util.concurrent.Future<T>
    Enclosing class:
    CoroutineScope

    public static class CoroutineScope.ScopeFuture<T>
    extends java.lang.Object
    implements java.util.concurrent.Future<T>
    An implementation of the future interface that wraps a scope execution.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancel​(boolean mayInterruptIfRunning)  
      T get()  
      T get​(long timeout, java.util.concurrent.TimeUnit unit)  
      boolean isCancelled()  
      boolean isDone()  
      • Methods inherited from class java.lang.Object

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

      • ScopeFuture

        public ScopeFuture​(CoroutineScope scope,
                           java.util.function.Function<? super CoroutineScope,​T> getResult,
                           CoroutineScope.ScopeCode code)
        Creates a new instance for a certain scope.
        Parameters:
        scope - The scope to await for the result
        getResult - A function that retrieves the result from the scope or NULL to always return NULL
        code - The code to be executed in the scope
    • Method Detail

      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future<T>
      • get

        public T get()
        Specified by:
        get in interface java.util.concurrent.Future<T>
      • get

        public T get​(long timeout,
                     java.util.concurrent.TimeUnit unit)
        Specified by:
        get in interface java.util.concurrent.Future<T>
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface java.util.concurrent.Future<T>
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface java.util.concurrent.Future<T>