Class AsyncResult<V>

java.lang.Object
org.springframework.scheduling.annotation.AsyncResult<V>
Type Parameters:
V - the value type
All Implemented Interfaces:
Future<V>, org.springframework.util.concurrent.ListenableFuture<V>

@Deprecated(since="6.0") public class AsyncResult<V> extends Object implements org.springframework.util.concurrent.ListenableFuture<V>
Deprecated.
as of 6.0, in favor of CompletableFuture
A pass-through Future handle that can be used for method signatures which are declared with a Future return type for asynchronous execution.

As of Spring 4.1, this class implements ListenableFuture, not just plain Future, along with the corresponding support in @Async processing.

As of Spring 4.2, this class also supports passing execution exceptions back to the caller.

Since:
3.0
Author:
Juergen Hoeller, Rossen Stoyanchev
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    AsyncResult(V value)
    Deprecated.
    Create a new AsyncResult holder.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCallback(org.springframework.util.concurrent.ListenableFutureCallback<? super V> callback)
    Deprecated.
     
    void
    addCallback(org.springframework.util.concurrent.SuccessCallback<? super V> successCallback, org.springframework.util.concurrent.FailureCallback failureCallback)
    Deprecated.
     
    boolean
    cancel(boolean mayInterruptIfRunning)
    Deprecated.
     
    Deprecated.
     
    static <V> org.springframework.util.concurrent.ListenableFuture<V>
    Deprecated.
    Create a new async result which exposes the given exception as an ExecutionException from Future.get().
    static <V> org.springframework.util.concurrent.ListenableFuture<V>
    forValue(V value)
    Deprecated.
    Create a new async result which exposes the given value from Future.get().
    get()
    Deprecated.
     
    get(long timeout, TimeUnit unit)
    Deprecated.
     
    boolean
    Deprecated.
     
    boolean
    Deprecated.
     

    Methods inherited from class java.lang.Object

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

    • AsyncResult

      public AsyncResult(@Nullable V value)
      Deprecated.
      Create a new AsyncResult holder.
      Parameters:
      value - the value to pass through
  • Method Details

    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Deprecated.
      Specified by:
      cancel in interface Future<V>
    • isCancelled

      public boolean isCancelled()
      Deprecated.
      Specified by:
      isCancelled in interface Future<V>
    • isDone

      public boolean isDone()
      Deprecated.
      Specified by:
      isDone in interface Future<V>
    • get

      @Nullable public V get() throws ExecutionException
      Deprecated.
      Specified by:
      get in interface Future<V>
      Throws:
      ExecutionException
    • get

      @Nullable public V get(long timeout, TimeUnit unit) throws ExecutionException
      Deprecated.
      Specified by:
      get in interface Future<V>
      Throws:
      ExecutionException
    • addCallback

      public void addCallback(org.springframework.util.concurrent.ListenableFutureCallback<? super V> callback)
      Deprecated.
      Specified by:
      addCallback in interface org.springframework.util.concurrent.ListenableFuture<V>
    • addCallback

      public void addCallback(org.springframework.util.concurrent.SuccessCallback<? super V> successCallback, org.springframework.util.concurrent.FailureCallback failureCallback)
      Deprecated.
      Specified by:
      addCallback in interface org.springframework.util.concurrent.ListenableFuture<V>
    • completable

      public CompletableFuture<V> completable()
      Deprecated.
      Specified by:
      completable in interface org.springframework.util.concurrent.ListenableFuture<V>
    • forValue

      public static <V> org.springframework.util.concurrent.ListenableFuture<V> forValue(V value)
      Deprecated.
      Create a new async result which exposes the given value from Future.get().
      Parameters:
      value - the value to expose
      Since:
      4.2
      See Also:
    • forExecutionException

      public static <V> org.springframework.util.concurrent.ListenableFuture<V> forExecutionException(Throwable ex)
      Deprecated.
      Create a new async result which exposes the given exception as an ExecutionException from Future.get().
      Parameters:
      ex - the exception to expose (either an pre-built ExecutionException or a cause to be wrapped in an ExecutionException)
      Since:
      4.2
      See Also: