cz.cuni.amis.utils.future
Class FixedFuture<Result>

java.lang.Object
  extended by cz.cuni.amis.utils.future.FixedFuture<Result>
All Implemented Interfaces:
IFuture<Result>, java.util.concurrent.Future<Result>

public class FixedFuture<Result>
extends java.lang.Object
implements IFuture<Result>

Future implementation that holds fixed result.


Constructor Summary
FixedFuture(Result 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, java.util.concurrent.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
 

Constructor Detail

FixedFuture

public FixedFuture(Result result)
Method Detail

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface java.util.concurrent.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 java.util.concurrent.Future<Result>
Returns:
the computed result

get

public Result get(long timeout,
                  java.util.concurrent.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 java.util.concurrent.Future<Result>
Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Returns:
the computed result

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface java.util.concurrent.Future<Result>

isDone

public boolean isDone()
Specified by:
isDone in interface java.util.concurrent.Future<Result>