com.levigo.util.concurrent
Class PrecompletedFuture<V>
java.lang.Object
com.levigo.util.concurrent.PrecompletedFuture<V>
- Type Parameters:
V
- the value type
- All Implemented Interfaces:
- Future<V>
public class PrecompletedFuture<V>
- extends Object
- implements Future<V>
An implementation of Future
which is already completed at the time of creation.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PrecompletedFuture
public PrecompletedFuture(V value)
- Create a pre-completed future with the given result value.
- Parameters:
value
-
PrecompletedFuture
public PrecompletedFuture(Throwable throwable)
- Create a pre-completed future for a failed operation which will throw the given
Throwable
(wrapped in an ExecutionException
) upon calling get()
.
- Parameters:
throwable
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface Future<V>
get
public V get()
throws ExecutionException
- Specified by:
get
in interface Future<V>
- Throws:
ExecutionException
get
public V get(long timeout,
TimeUnit unit)
throws ExecutionException
- Specified by:
get
in interface Future<V>
- Throws:
ExecutionException
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface Future<V>
isDone
public boolean isDone()
- Specified by:
isDone
in interface Future<V>
Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.