cz.cuni.amis.utils.future
Class FutureWrapper<RESULT>

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

public class FutureWrapper<RESULT>
extends java.lang.Object
implements IFuture<RESULT>


Constructor Summary
FutureWrapper(IFuture<RESULT> impl)
           
 
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

FutureWrapper

public FutureWrapper(IFuture<RESULT> impl)
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>