Skip to content

Commit

Permalink
updates in response to PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrd committed Sep 19, 2023
1 parent 1a96a29 commit 5ae7e8b
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ public void startPolling () {
// Create an executor with one thread per processor. The default task rejection policy is "Abort".
// The number of threads will only increase from the core pool size toward the max pool size when the queue is
// full. We no longer exceed the queue length in normal operation, so the thread pool will remain at core size.
// "[The] core pool size is the threshold beyond which [an] executor service prefers to queue up the task than
// spawn a new thread."
// "[The] core pool size is the threshold beyond which [an] executor service prefers to queue up the task
// [rather] than spawn a new thread." https://stackoverflow.com/a/72684387/778449
// The executor's queue is rather long because some tasks complete very fast and we poll at most once per second.
int availableProcessors = Runtime.getRuntime().availableProcessors();
LOG.info("Java reports the number of available processors is: {}", availableProcessors);
Expand Down Expand Up @@ -613,9 +613,10 @@ public List<RegionalTask> getSomeWork (int tasksToRequest) {
// Broker returned some work. Use the lenient object mapper to decode it in case the broker is a
// newer version so sending unrecognizable fields.
// ReadValue closes the stream, releasing the HTTP connection.
List<RegionalTask> tasks = JsonUtilities.lenientObjectMapper.readValue(responseEntity.getContent(),
new TypeReference<List<RegionalTask>>() {});
return tasks;
return JsonUtilities.lenientObjectMapper.readValue(
responseEntity.getContent(),
new TypeReference<List<RegionalTask>>() {}
);
}
// Non-200 response code or a null entity. Something is weird.
LOG.error("Unsuccessful polling. HTTP response code: " + response.getStatusLine().getStatusCode());
Expand Down

0 comments on commit 5ae7e8b

Please sign in to comment.