Skip to content

Conversation

@lqiu96
Copy link
Member

@lqiu96 lqiu96 commented May 12, 2023

Thank you for opening a Pull Request! For general contributing guidelines, please refer to contributing guide

Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes: #1663

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label May 12, 2023
@lqiu96 lqiu96 marked this pull request as ready for review May 12, 2023 19:18
@lqiu96 lqiu96 requested a review from a team as a code owner May 12, 2023 19:18
@lqiu96 lqiu96 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2023
@lqiu96
Copy link
Member Author

lqiu96 commented May 18, 2023

Added additional comments to the PR. I'll add a section for our docs.

Copy link
Contributor

@blakeli0 blakeli0 left a comment

Choose a reason for hiding this comment

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

Thanks Lawrence, the general approach makes sense if we can confirm that using a default executor from InstantiatingHttpJsonChannelProvider is fine. Also can you please add some tests to it? I know we didn't have any unit tests for it previously and it would be tricky to test executors.

return thread;
}
};
private static final int MIN_CPU_AMOUNT = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be MIN_THREAD_AMOUNT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. Updating.

public static Builder newBuilder() {
int numCpus = Runtime.getRuntime().availableProcessors();
int numThreads = Math.max(4, numCpus);
int numThreads = Math.max(MIN_CPU_AMOUNT, numCpus);
Copy link
Contributor

Choose a reason for hiding this comment

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

I was expecting this change only in ManagedHttpJsonChannel, changing it here should be fine as well, but be aware that changing this in InstantiatingExecutorProvider would affect the current background tasks used for grpc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense.I created a new builder: newIOBuilder that should only be used for HttpJson's async calls and wouldn't change the background executor.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 2, 2023

[gapic-generator-java-root] SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

44.9% 44.9% Coverage
0.0% 0.0% Duplication

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 2, 2023

[java_showcase_integration_tests] SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

41.6% 41.6% Coverage
0.0% 0.0% Duplication

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 2, 2023

[java_showcase_unit_tests] SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

47.2% 47.2% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement awaitTermination() for HttpJson's Channel

3 participants