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

Deprecate Tasks.par(...) for safer alternative Task.par(...) that does not throw IllegalArgumentException on empty collection. #113

Merged
merged 4 commits into from
Mar 2, 2017

Conversation

dimapilis
Copy link
Contributor

Deprecate Tasks.par(...) for safer alternative Task.par(...) that does not throw IllegalArgumentException on empty collection.

…s not throw IllegalArgumentException on empty collection.
Copy link

@jodzga jodzga left a comment

Choose a reason for hiding this comment

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

Minor comments regarding javadoc.

Could you also update CHANGELOG ?

* {@link com.linkedin.parseq.ParTask#getTasks()} or
* {@link com.linkedin.parseq.ParTask#getSuccessful()} to get results in this
* case.
* <p>
Copy link

Choose a reason for hiding this comment

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

Document behavior when when Iterable is empty.

*
* @param tasks the tasks to run in parallel
* @return The results of the tasks
* @deprecated As of 2.0.0, replaced by {@link Task#par(Iterable) Task.par}
Copy link

Choose a reason for hiding this comment

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

Document difference in behavior between this method and the Task.par(Iterable)

Copy link

@jodzga jodzga left a comment

Choose a reason for hiding this comment

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

Ship it!

Copy link
Contributor

@ssodhanilinkedin ssodhanilinkedin left a comment

Choose a reason for hiding this comment

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

looks good. thanks! please make javadoc changes as suggested by Jarek.

@stevenheidel
Copy link

Great work on this! Can't wait to see this get merged, we just had a production bug because of the old behavior. Thanks for taking initiative and putting up a fix so quickly.

@@ -63,6 +68,11 @@ public ParTaskImpl(final String name, final Iterable<? extends Task<? extends T>
protected Promise<List<T>> run(final Context context) throws Exception {
final SettablePromise<List<T>> result = Promises.settable();

if (_tasks.isEmpty()) {
result.done(Collections.<T>emptyList());
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe even return Promises.value(Collections.<T>emptyList());
and move it before line 69?

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

Successfully merging this pull request may close these issues.

None yet

5 participants