org.h2.util
Class LazyFuture<T>

java.lang.Object
  extended by org.h2.util.LazyFuture<T>
Type Parameters:
T -
All Implemented Interfaces:
java.util.concurrent.Future<T>

public abstract class LazyFuture<T>
extends java.lang.Object
implements java.util.concurrent.Future<T>

Single threaded lazy future.


Constructor Summary
LazyFuture()
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 T get()
           
 T get(long timeout, java.util.concurrent.TimeUnit unit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 boolean reset()
          Reset this future to the initial state.
protected abstract  T run()
          Run computation and produce the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyFuture

public LazyFuture()
Method Detail

reset

public boolean reset()
Reset this future to the initial state.

Returns:
false if it was already in initial state

run

protected abstract T run()
                  throws java.lang.Exception
Run computation and produce the result.

Returns:
the result of computation
Throws:
java.lang.Exception

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface java.util.concurrent.Future<T>

get

public T get()
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException
Specified by:
get in interface java.util.concurrent.Future<T>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

get

public T get(long timeout,
             java.util.concurrent.TimeUnit unit)
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException
Specified by:
get in interface java.util.concurrent.Future<T>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

isCancelled

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

isDone

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