Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Add TransformableFuture.combined #66

Closed
wants to merge 1 commit into from
Closed

Conversation

alechenninger
Copy link
Contributor

Please do not merge yet. Needs tests. Feel free to comment though.

This allows, among other things, for message implementations to share
logic with types that produce TransformableFutures, and combine
additional work on top of that. Put in other words, it allows any of
our Future based APIs to be implemented with any number of Futures
internally if they needed (rare but happens), as long as they are
returned combined.

The semantics of a combined future is [hopefully] what you would expect,
and follows Guava's Futures.allAsList. For example, cancel cancels all
futures, isCancelled returns true if any of the futures are cancelled,
isDone returns true only if all of the futures are done, etc.

Please do not merge yet. Needs tests. Feel free to comment though.

This allows, among other things, for message implementations to share
logic with types that produce TransformableFutures, and combine
additional work on top of that. Put in other words, it allows any of
our Future based APIs to be implemented with any number of Futures
internally if they needed (rare but happens), as long as they are
returned combined.

The semantics of a combined future is [hopefully] what you would expect,
and follows Guava's Futures.allAsList. For example, cancel cancels all
futures, isCancelled returns true if any of the futures are cancelled,
isDone returns true only if all of the futures are done, etc.
public U get() throws InterruptedException, ExecutionException {
try {
return futureTransform.transform(combined.get());
} catch (Exception e) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would erroneously catch and rethrow exceptions from combined.get()... need to test and fix

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.6%) to 56.036% when pulling 278a02c on combined-future into 813ed63 on master.

@alechenninger
Copy link
Contributor Author

I'm going to rework this a bit. Will come back to in later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants