org.teiid.client.util
Class ResultsFuture<T>

java.lang.Object
  extended by org.teiid.client.util.ResultsFuture<T>
All Implemented Interfaces:
Future<T>

public class ResultsFuture<T>
extends Object
implements Future<T>

Implements a call back based future that can also have completion listeners.


Nested Class Summary
static interface ResultsFuture.CompletionListener<T>
           
 
Field Summary
static ResultsFuture<Void> NULL_FUTURE
           
 
Constructor Summary
ResultsFuture()
           
 
Method Summary
 void addCompletionListener(ResultsFuture.CompletionListener<T> listener)
           
 boolean cancel(boolean mayInterruptIfRunning)
           
protected  T convertResult()
           
 T get()
           
 T get(long timeout, TimeUnit unit)
           
 ResultsReceiver<T> getResultsReceiver()
           
 boolean isCancelled()
           
 boolean isDone()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_FUTURE

public static ResultsFuture<Void> NULL_FUTURE
Constructor Detail

ResultsFuture

public ResultsFuture()
Method Detail

getResultsReceiver

public ResultsReceiver<T> getResultsReceiver()

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<T>

get

public T get()
      throws InterruptedException,
             ExecutionException
Specified by:
get in interface Future<T>
Throws:
InterruptedException
ExecutionException

convertResult

protected T convertResult()
                   throws ExecutionException
Throws:
ExecutionException

get

public T get(long timeout,
             TimeUnit unit)
      throws InterruptedException,
             ExecutionException,
             TimeoutException
Specified by:
get in interface Future<T>
Throws:
InterruptedException
ExecutionException
TimeoutException

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<T>

isDone

public boolean isDone()
Specified by:
isDone in interface Future<T>

addCompletionListener

public void addCompletionListener(ResultsFuture.CompletionListener<T> listener)


Copyright © 2012. All Rights Reserved.