Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-6555] [futures] Generalize ConjunctFuture to return results #3873

Closed

Conversation

tillrohrmann
Copy link
Contributor

The ConjunctFuture now returns the set of values of the individual futures it is composed of once it is completed.

Copy link
Contributor

@StephanEwen StephanEwen left a comment

Choose a reason for hiding this comment

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

Good addition, with one comment about thread safety.

I was thinking that we could we make this two separate conjunct futures? One with result, one without? I like that the future used for scheduling (with possibly 1000s of tasks) is very lightweight (no list or anything).

else if (numTotal == numCompleted.incrementAndGet()) {
complete(null);
} else {
results.add(o);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this thread safe? My assumption is that many of the completion handlers can be called at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I wanted to use the numCompleted as the index but forgot about it. Thanks for catching it.

@tillrohrmann
Copy link
Contributor Author

You're right with the thread safety. I will change it. I will introduce a WaitingFuture which will simply wait on the completion of all its futures and discard all future values, thus, returning null as a result.

@tillrohrmann
Copy link
Contributor Author

Updated the PR to incorporate the PR review. Thanks for the review @StephanEwen.

The ConjunctFuture now returns the set of future values once it is completed.
…onjunctFuture

The WaitingConjunctFuture waits for the completion of its futures. The future values
are discarded making it more efficient than the ResultConjunctFuture which returns
the futures' values. The WaitingConjunctFuture is instantiated via
FutureUtils.waitForAll(Collection<Future>).
tillrohrmann added a commit to tillrohrmann/flink that referenced this pull request May 15, 2017
The ConjunctFuture now returns the set of future values once it is completed.

Introduce WaitingConjunctFuture; Fix thread safety issue with ResultConjunctFuture

The WaitingConjunctFuture waits for the completion of its futures. The future values
are discarded making it more efficient than the ResultConjunctFuture which returns
the futures' values. The WaitingConjunctFuture is instantiated via
FutureUtils.waitForAll(Collection<Future>).

This closes apache#3873.
tillrohrmann added a commit to tillrohrmann/flink that referenced this pull request May 15, 2017
The ConjunctFuture now returns the set of future values once it is completed.

Introduce WaitingConjunctFuture; Fix thread safety issue with ResultConjunctFuture

The WaitingConjunctFuture waits for the completion of its futures. The future values
are discarded making it more efficient than the ResultConjunctFuture which returns
the futures' values. The WaitingConjunctFuture is instantiated via
FutureUtils.waitForAll(Collection<Future>).

This closes apache#3873.
tillrohrmann added a commit to tillrohrmann/flink that referenced this pull request May 16, 2017
The ConjunctFuture now returns the set of future values once it is completed.

Introduce WaitingConjunctFuture; Fix thread safety issue with ResultConjunctFuture

The WaitingConjunctFuture waits for the completion of its futures. The future values
are discarded making it more efficient than the ResultConjunctFuture which returns
the futures' values. The WaitingConjunctFuture is instantiated via
FutureUtils.waitForAll(Collection<Future>).

This closes apache#3873.
tillrohrmann added a commit to tillrohrmann/flink that referenced this pull request May 16, 2017
The ConjunctFuture now returns the set of future values once it is completed.

Introduce WaitingConjunctFuture; Fix thread safety issue with ResultConjunctFuture

The WaitingConjunctFuture waits for the completion of its futures. The future values
are discarded making it more efficient than the ResultConjunctFuture which returns
the futures' values. The WaitingConjunctFuture is instantiated via
FutureUtils.waitForAll(Collection<Future>).

This closes apache#3873.
asfgit pushed a commit that referenced this pull request May 17, 2017
The ConjunctFuture now returns the set of future values once it is completed.

Introduce WaitingConjunctFuture; Fix thread safety issue with ResultConjunctFuture

The WaitingConjunctFuture waits for the completion of its futures. The future values
are discarded making it more efficient than the ResultConjunctFuture which returns
the futures' values. The WaitingConjunctFuture is instantiated via
FutureUtils.waitForAll(Collection<Future>).

This closes #3873.
@asfgit asfgit closed this in c081201 May 17, 2017
@tillrohrmann tillrohrmann deleted the generalizeConjunctFuture branch July 6, 2017 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants