/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.aspects.asynch;

import java.lang.reflect.InvocationTargetException;

/**
 * Comment
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 * @version $Revision: 1.3.8.3 $
 */
public interface Future
{
   /**
    * get result, throws Exception of method or InterruptedException
    */
   public Object get() throws InterruptedException, InvocationTargetException;

   /**
    * get result, throws Exception of method or InterruptedException
    */
   public Object get(long milliseconds) throws TimeoutException, InterruptedException, InvocationTargetException;

   /**
    * is the method call done?
    */
   public boolean isDone();

   /**
    * Release this future so that it can be garbaged collected remotely
    * This is only useful for remote asynchronous.
    * This is import to call especially for remote otherwise the remote
    * future on the server will never get garbaged collected.
    * AsynchProvider will call release if it is holding a Future already
    * within its threadlocal when a new one is set on it.
    */
   public void release();
}
