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

Allow disabling closing the sharedOperationExecutor #1956

Closed
alxhill opened this issue Nov 20, 2024 · 1 comment
Closed

Allow disabling closing the sharedOperationExecutor #1956

alxhill opened this issue Nov 20, 2024 · 1 comment
Assignees
Labels
usability what affects usability of the client v2-feedback
Milestone

Comments

@alxhill
Copy link
Contributor

alxhill commented Nov 20, 2024

Currently, if you pass in an executorService to the client, it closes it when the client itself is closed. This means users who do the following:

try (Client client = createClient(executorService)) {
   ///
}

will cause any other usage of the same executorService to fail. We want to use a single shared executor service for our whole server for all clients, so would prefer it doesn't shut down when this pattern is used.

@chernser chernser added the usability what affects usability of the client label Nov 20, 2024
@chernser chernser added this to the Priority Backlog milestone Nov 20, 2024
@chernser
Copy link
Contributor

Good day, @alxhill !
Accepting an executor was made it let users customize behavior but your use-case is valid - for the client it is a borrowed resource and we might not to shutdown it. I will think about the fix - I would like to avoid another flag in configuration for that but changing behavior is also not good.

Just a note about such usage (I think, you know this, but just to note):

  • internal http client has connection pool so it might need to be disabled com.clickhouse.client.api.Client.Builder#enableConnectionPool
  • using async operations inside the client doesn't make sense if client instance is now shared.
  • application can put each query task in owned executor service in this case - anyway client is disposed after use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usability what affects usability of the client v2-feedback
Projects
None yet
Development

No branches or pull requests

2 participants