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

Conversation

Projects
None yet
3 participants
@ssalinas
Copy link
Member

ssalinas commented Oct 30, 2015

@@ -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()),

This comment has been minimized.

Copy link
@tpetr

tpetr Oct 30, 2015

Member

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

This comment has been minimized.

Copy link
@ssalinas

ssalinas Oct 30, 2015

Author Member

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

@@ -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) {

This comment has been minimized.

Copy link
@wsorenson

wsorenson Oct 30, 2015

Member

isEmpty() is preferable I believe.

@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 pull request Nov 3, 2015

Merge pull request #743 from HubSpot/prefixes
thread pool of 1 if prefixes is 0, avoid IllegalArgument

@tpetr tpetr merged commit 4774163 into master Nov 3, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@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
You can’t perform that action at this time.