All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.ejb.AsyncResult Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and Jakarta Messaging BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up with different versions on classes on the class path).

There is a newer version: 35.0.0.Beta1
Show 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;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy