feat: support setting core pool size for async API in system property#2632
Merged
gcf-merge-on-green[bot] merged 3 commits intomainfrom Oct 4, 2023
Merged
feat: support setting core pool size for async API in system property#2632gcf-merge-on-green[bot] merged 3 commits intomainfrom
gcf-merge-on-green[bot] merged 3 commits intomainfrom
Conversation
Add support for setting the core pool size for the thread pool that is used for the Async API using a system property. This allows users to change this property without having to change code, and to set the property if they are using a framework that builds on top of the client library, but that does not have a configuration option for setting a custom executor provider. Fixes #2631
arpan14
reviewed
Oct 4, 2023
|
|
||
| @Test | ||
| public void testAsyncExecutorProviderCoreThreadCount() throws Exception { | ||
| assertEquals(8, SpannerOptions.getDefaultAsyncExecutorProviderCoreThreadCount()); |
Contributor
There was a problem hiding this comment.
nit: Should we add a check to ensure that the system property was originally unset? Or maybe explicitly set the property to null?
Contributor
There was a problem hiding this comment.
I see that there is a handling of this scenario within the finally block of runWithSystemProperty method, but thought if explicitly setting null would be better to ensure that the default behaviour is due to null property and not because somehow the property was already set to 8.
Collaborator
Author
There was a problem hiding this comment.
I added a test for both null and an empty string.
arpan14
approved these changes
Oct 4, 2023
surbhigarg92
pushed a commit
to surbhigarg92/java-spanner
that referenced
this pull request
Oct 5, 2023
…googleapis#2632) Add support for setting the core pool size for the thread pool that is used for the Async API using a system property. This allows users to change this property without having to change code, and to set the property if they are using a framework that builds on top of the client library, but that does not have a configuration option for setting a custom executor provider. Fixes googleapis#2631
gcf-merge-on-green bot
pushed a commit
that referenced
this pull request
Oct 10, 2023
🤖 I have created a release *beep* *boop* --- ## [6.50.0](https://togithub.com/googleapis/java-spanner/compare/v6.49.0...v6.50.0) (2023-10-09) ### Features * Support setting core pool size for async API in system property ([#2632](https://togithub.com/googleapis/java-spanner/issues/2632)) ([e51c55d](https://togithub.com/googleapis/java-spanner/commit/e51c55d332bacb9d174a24b0d842b2cba4762db8)), closes [#2631](https://togithub.com/googleapis/java-spanner/issues/2631) ### Dependencies * Update dependency com.google.cloud:google-cloud-trace to v2.24.0 ([#2577](https://togithub.com/googleapis/java-spanner/issues/2577)) ([311c2ad](https://togithub.com/googleapis/java-spanner/commit/311c2ad97311490893f3abf4da5fe4d511c445dd)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
psinghbay1
reviewed
Oct 10, 2023
|
|
||
| @VisibleForTesting | ||
| static int getDefaultAsyncExecutorProviderCoreThreadCount() { | ||
| String propertyName = "SPANNER_ASYNC_NUM_CORE_THREADS"; |
There was a problem hiding this comment.
magic string!
should we maintain list of constants/enums property names?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for setting the core pool size for the thread pool that is used for the Async API using a system property. This allows users to change this property without having to change code, and to set the property if they are using a framework that builds on top of the client library, but that does not have a configuration option for setting a custom executor provider.
Fixes #2631