Class ImmediateFuture<T>

java.lang.Object
ch.raffael.meldioc.util.concurrent.ImmediateFuture<T>
All Implemented Interfaces:
java.util.concurrent.Future<T>

public final class ImmediateFuture<T>
extends java.lang.Object
implements java.util.concurrent.Future<T>
A Future implementation that's run immediately in the constructing thread. Instances of this are always completed.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  ImmediateFuture.Cancelled<T>  
  • Method Summary

    Modifier and Type Method Description
    boolean cancel​(boolean mayInterruptIfRunning)  
    static <T> ImmediateFuture.Cancelled<T> cancelled()  
    T get()  
    T get​(long timeout, java.util.concurrent.TimeUnit unit)  
    boolean isCancelled()  
    boolean isDone()  
    static <T> ImmediateFuture<T> of​(io.vavr.CheckedFunction0<T> supplier)  
    static <T> ImmediateFuture<T> of​(io.vavr.control.Try<T> result)  
    static <T> ImmediateFuture<T> ofCallable​(java.util.concurrent.Callable<T> callable)  
    io.vavr.control.Try<T> result()  
    static ImmediateFuture<java.lang.Void> run​(io.vavr.CheckedRunnable runnable)  
    static ImmediateFuture<java.lang.Void> runRunnable​(java.lang.Runnable runnable)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static <T> ImmediateFuture<T> of​(io.vavr.control.Try<T> result)
    • of

      public static <T> ImmediateFuture<T> of​(io.vavr.CheckedFunction0<T> supplier)
    • run

      public static ImmediateFuture<java.lang.Void> run​(io.vavr.CheckedRunnable runnable)
    • runRunnable

      public static ImmediateFuture<java.lang.Void> runRunnable​(java.lang.Runnable runnable)
    • ofCallable

      public static <T> ImmediateFuture<T> ofCallable​(java.util.concurrent.Callable<T> callable)
    • cancelled

      public static <T> ImmediateFuture.Cancelled<T> cancelled()
    • cancel

      public boolean cancel​(boolean mayInterruptIfRunning)
      Specified by:
      cancel 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>
    • get

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

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

      public io.vavr.control.Try<T> result()