cz.cuni.amis.utils.future
Class FixedFuture<Result>
java.lang.Object
cz.cuni.amis.utils.future.FixedFuture<Result>
- All Implemented Interfaces:
- IFuture<Result>, Future<Result>
public class FixedFuture<Result>
- extends Object
- implements IFuture<Result>
Future implementation that holds fixed result.
Method Summary |
boolean |
cancel(boolean mayInterruptIfRunning)
|
Result |
get()
Waits if necessary for the computation to complete, and then
retrieves its result. |
Result |
get(long timeout,
TimeUnit unit)
Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result, if available. |
boolean |
isCancelled()
|
boolean |
isDone()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FixedFuture
public FixedFuture(Result result)
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface Future<Result>
get
public Result get()
- Description copied from interface:
IFuture
- Waits if necessary for the computation to complete, and then
retrieves its result.
- Specified by:
get
in interface IFuture<Result>
- Specified by:
get
in interface Future<Result>
- Returns:
- the computed result
get
public Result get(long timeout,
TimeUnit unit)
- Description copied from interface:
IFuture
- Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result, if available.
- Specified by:
get
in interface IFuture<Result>
- Specified by:
get
in interface Future<Result>
- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument
- Returns:
- the computed result
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface Future<Result>
isDone
public boolean isDone()
- Specified by:
isDone
in interface Future<Result>
Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.