javax.ejb.AsyncResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jboss-ejb-api_3.1_spec Show documentation
Show all versions of jboss-ejb-api_3.1_spec Show documentation
The Java EJB 3.1 API classes
The newest version!
package javax.ejb;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* Wraps the result of an asynchronous method call as a Future object
* preserving compatibility with the business interface signature. The value specified
* in the constructor will be retrieved by the container and made available to the client.
* Note that this object is not passed to the client. It is merely a convenience for
* providing the result value to the container. Therefore, none of its
* instance methods should be called by the application.
*
* @author Carlo de Wolf
* @version $Revision$
* @since 3.1
*/
public final class AsyncResult implements Future
{
private static final long serialVersionUID = 1L;
private V result;
public AsyncResult(V result)
{
this.result = result;
}
public boolean cancel(boolean mayInterruptIfRunning)
{
return false;
}
public V get() throws InterruptedException, ExecutionException
{
return result;
}
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
{
return result;
}
public boolean isCancelled()
{
return false;
}
public boolean isDone()
{
return true;
}
}