Created
February 14, 2017 19:35
-
-
Save ipapaste/f4807cc9e86fb2b9b3db3c917a1815d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static <T> Tuple2<Future<T>, AsyncCallback<T>> make() { | |
final Promise<T> promise = Promise.make(); | |
final AsyncCallback<T> callback = new AsyncCallback<T>() { | |
@Override | |
public void onFailure(final Throwable throwable) { | |
promise.failure(throwable); | |
} | |
@Override | |
public void onSuccess(final T t) { | |
promise.success(t); | |
} | |
}; | |
return Tuple.of(promise.future(), callback); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment