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

thread pool of 1 if prefixes is 0, avoid IllegalArgument #743

Merged
merged 3 commits into from Nov 3, 2015
Merged

Conversation

@ssalinas
Copy link
Member

@ssalinas ssalinas commented Oct 30, 2015

@tpetr

@@ -238,7 +238,7 @@ public SingularityS3Log call() throws Exception {
}

private List<SingularityS3Log> getS3Logs(Optional<String> group, Collection<String> prefixes) throws InterruptedException, ExecutionException, TimeoutException {
ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(Math.min(prefixes.size(), configuration.get().getMaxS3Threads()),
ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(Math.min(prefixes.size() == 0 ? 1 : prefixes.size(), configuration.get().getMaxS3Threads()),
Copy link
Member

@tpetr tpetr Oct 30, 2015

Choose a reason for hiding this comment

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

idk why i suggested that route -- can't we just short-circuit to Collections.emptyList() if there are no prefixes?

Loading

Copy link
Member Author

@ssalinas ssalinas Oct 30, 2015

Choose a reason for hiding this comment

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

you and your logical ideas... 😜 I'll update

Loading

@@ -238,6 +238,10 @@ public SingularityS3Log call() throws Exception {
}

private List<SingularityS3Log> getS3Logs(Optional<String> group, Collection<String> prefixes) throws InterruptedException, ExecutionException, TimeoutException {
if (prefixes.size() == 0) {
Copy link
Contributor

@wsorenson wsorenson Oct 30, 2015

Choose a reason for hiding this comment

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

isEmpty() is preferable I believe.

Loading

@tpetr tpetr added this to the 0.4.6 milestone Nov 3, 2015
@tpetr tpetr added the hs_stable label Nov 3, 2015
tpetr added a commit that referenced this issue Nov 3, 2015
thread pool of 1 if prefixes is 0, avoid IllegalArgument
@tpetr tpetr merged commit 4774163 into master Nov 3, 2015
2 checks passed
Loading
@tpetr tpetr removed hs_qa labels Nov 3, 2015
@tpetr tpetr deleted the prefixes branch Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants