|
|
@ -21,9 +21,9 @@ import java.util.concurrent.ExecutionException; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Abstract class that adapts a {@link ListenableFuture} parameterized over S into a |
|
|
|
* Abstract class that adapts a {@link ListenableFuture} parameterized over S into a |
|
|
|
* {@code ListenableFuture} parameterized over T. All methods are delegated to the |
|
|
|
* {@code ListenableFuture} parameterized over T. All methods are delegated to the |
|
|
|
* adaptee, where {@link #get()}, {@link #get(long, java.util.concurrent.TimeUnit)}, and |
|
|
|
* adaptee, where {@link #get()}, {@link #get(long, java.util.concurrent.TimeUnit)}, |
|
|
|
* {@link ListenableFutureCallback#onSuccess(Object)} call {@link #adapt(Object)} on the |
|
|
|
* and {@link ListenableFutureCallback#onSuccess(Object)} call {@link #adapt(Object)} |
|
|
|
* adaptee's result. |
|
|
|
* on the adaptee's result. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param <T> the type of this {@code Future} |
|
|
|
* @param <T> the type of this {@code Future} |
|
|
|
* @param <S> the type of the adaptee's {@code Future} |
|
|
|
* @param <S> the type of the adaptee's {@code Future} |
|
|
@ -34,7 +34,7 @@ public abstract class ListenableFutureAdapter<T, S> extends FutureAdapter<T, S> |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Construct a new {@code ListenableFutureAdapter} with the given adaptee. |
|
|
|
* Construct a new {@code ListenableFutureAdapter} with the given adaptee. |
|
|
|
* @param adaptee the future to adaptee to |
|
|
|
* @param adaptee the future to adapt to |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected ListenableFutureAdapter(ListenableFuture<S> adaptee) { |
|
|
|
protected ListenableFutureAdapter(ListenableFuture<S> adaptee) { |
|
|
|
super(adaptee); |
|
|
|
super(adaptee); |
|
|
@ -59,8 +59,8 @@ public abstract class ListenableFutureAdapter<T, S> extends FutureAdapter<T, S> |
|
|
|
Throwable cause = ex.getCause(); |
|
|
|
Throwable cause = ex.getCause(); |
|
|
|
onFailure(cause != null ? cause : ex); |
|
|
|
onFailure(cause != null ? cause : ex); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Throwable t) { |
|
|
|
catch (Throwable ex) { |
|
|
|
onFailure(t); |
|
|
|
onFailure(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@Override |
|
|
|
@Override |
|
|
|