org.jclouds.concurrent
Class ExceptionParsingListenableFuture<T>

java.lang.Object
  extended by org.jclouds.concurrent.ExceptionParsingListenableFuture<T>
All Implemented Interfaces:
com.google.common.util.concurrent.ListenableFuture<T>, Future<T>

public class ExceptionParsingListenableFuture<T>
extends Object
implements com.google.common.util.concurrent.ListenableFuture<T>

Transforms the exceptions in a future upon get Temporarily here until the following is resolved: guava issue 310

Author:
Adrian Cole

Constructor Summary
ExceptionParsingListenableFuture(com.google.common.util.concurrent.ListenableFuture<T> future, com.google.common.base.Function<Exception,T> function)
           
 
Method Summary
 void addListener(Runnable listener, Executor exec)
           
 boolean cancel(boolean mayInterruptIfRunning)
           
static
<T> ExceptionParsingListenableFuture<T>
create(com.google.common.util.concurrent.ListenableFuture<T> future, com.google.common.base.Function<Exception,T> function)
           
 T get()
           
 T get(long timeout, TimeUnit unit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionParsingListenableFuture

public ExceptionParsingListenableFuture(com.google.common.util.concurrent.ListenableFuture<T> future,
                                        com.google.common.base.Function<Exception,T> function)
Method Detail

create

public static <T> ExceptionParsingListenableFuture<T> create(com.google.common.util.concurrent.ListenableFuture<T> future,
                                                             com.google.common.base.Function<Exception,T> function)

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<T>

get

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

get

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

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<T>

isDone

public boolean isDone()
Specified by:
isDone in interface Future<T>

addListener

public void addListener(Runnable listener,
                        Executor exec)
Specified by:
addListener in interface com.google.common.util.concurrent.ListenableFuture<T>


Copyright © 2009-2011 jclouds. All Rights Reserved.