org.modeshape.common.util
Class ImmediateFuture<V>
java.lang.Object
org.modeshape.common.util.ImmediateFuture<V>
- Type Parameters:
V - the type of result
- All Implemented Interfaces:
- Future<V>
@Immutable
public final class ImmediateFuture<V>
- extends Object
- implements Future<V>
A Future implementation that is immediately done.
|
Constructor Summary |
ImmediateFuture(V value)
Create a new Future instance that is completed immediately and returns the supplied result. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ImmediateFuture
public ImmediateFuture(V value)
- Create a new
Future instance that is completed immediately and returns the supplied result.
- Parameters:
value - the value that the future should return
create
public static <T> ImmediateFuture<T> create(T value)
- Factory method to more easily create an immediate future
- Type Parameters:
T - the value type- Parameters:
value - the value that the future should return
- Returns:
- the new future; never null
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel in interface Future<V>
get
public V get()
- Specified by:
get in interface Future<V>
get
public V get(long timeout,
TimeUnit unit)
- Specified by:
get in interface Future<V>
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled in interface Future<V>
isDone
public boolean isDone()
- Specified by:
isDone in interface Future<V>
Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.