org.jboss.seam.cron.api.asynchronous
Class AsyncResult<T>

java.lang.Object
  extended by org.jboss.seam.cron.api.asynchronous.AsyncResult<T>
All Implemented Interfaces:
Future<T>

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

This is a convenience implementation of #Future which can be used as the return value of an @#Asynchronous method. This is useful because it prompts Seam Cron to re-wrap the asynchronous method execution in a legitimate #FutureTask and return that immediately to the calling method.

Author:
Peter Royle

Constructor Summary
AsyncResult(T result)
          Wraps the given result in a #Future.
 
Method Summary
 boolean cancel(boolean bln)
          This "dummy" Future represents a calculation which has already been performed, and thus cannot be canceled.
 T get()
           
 T get(long l, TimeUnit tu)
           
 boolean isCancelled()
          This "dummy" Future represents a calculation which has already been performed, and thus cannot be canceled.
 boolean isDone()
          This "dummy" Future represents a calculation which has already been performed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncResult

public AsyncResult(T result)
Wraps the given result in a #Future.

Parameters:
result -
Method Detail

cancel

public boolean cancel(boolean bln)
This "dummy" Future represents a calculation which has already been performed, and thus cannot be canceled.

Specified by:
cancel in interface Future<T>
Parameters:
bln - Whether r not to attempt to cancel the task.
Returns:
false every time

isCancelled

public boolean isCancelled()
This "dummy" Future represents a calculation which has already been performed, and thus cannot be canceled.

Specified by:
isCancelled in interface Future<T>
Parameters:
bln - Whether r not to attempt to cancel the task.
Returns:
false every time

isDone

public boolean isDone()
This "dummy" Future represents a calculation which has already been performed.

Specified by:
isDone in interface Future<T>
Returns:
true every time

get

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

get

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


Copyright © 2011 Seam Framework. All Rights Reserved.