Result.java :  » Google-tech » objectify-appengine » com » googlecode » objectify » Java Open Source

Java Open Source » Google tech » objectify appengine 
objectify appengine » com » googlecode » objectify » Result.java
package com.googlecode.objectify;

import java.util.concurrent.Future;


/**
 * <p>
 * This interface provides a return value for asynchronous Objectify calls,
 * nearly the same as {@code java.util.concurrent.Future}. Unfortunately the methods
 * of {@code Future} throw checked exceptions, rendering the class prohibitively
 * painful to use in business logic.  This interface fixes that problem, and implementors
 * automatically unwrap ExecutionExceptions (checked exceptions will be wrapped in a
 * new RuntimeException).
 * </p>
 * 
 * @author Jeff Schnitzer <jeff@infohazard.org>
 */
public interface Result<T>
{
  /**
   * Waits if necessary for the computation to complete, and then retrieves
   * its result.  If the computation produced an exception, it will be thrown here.
   * 
   * @return the computed result
   */
  T get();
  
  /**
   * @return the underlying Future object
   */
  Future<T> getFuture();
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.