Skip to content

In OkHttpEngine builder add executorService field. #1259

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

Open
1 task
szymonsasin-nordic opened this issue Mar 26, 2025 · 3 comments
Open
1 task

In OkHttpEngine builder add executorService field. #1259

szymonsasin-nordic opened this issue Mar 26, 2025 · 3 comments
Assignees
Labels
feature-request A feature should be added or improved.

Comments

@szymonsasin-nordic
Copy link

Describe the feature

In OkHttpEngine builder give an option to pass own executorService.

Is your feature request related to a problem?

Reusing executorservice should help conserve system resources by avoiding the creation of multiple thread pools. Especially when application is using multiple components that uses threadpools.

Proposed Solution

val commonThreadPool = Executors.newFixedThreadPool(4)
...
OkHttpEngine {
    executorService = commonThreadPool
}

Describe alternative solutions or features you've considered

Another option would be to pass whole Dispatcher instance.

Acknowledge

  • I may be able to implement this feature request

Smithy-Kotlin version

1.4.11

Platform (JVM/JS/Native)

JVM

Operating system and version

NA

@szymonsasin-nordic szymonsasin-nordic added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 26, 2025
@ianbotsf ianbotsf removed the needs-triage This issue or PR still needs to be triaged. label Mar 26, 2025
@ianbotsf ianbotsf self-assigned this Mar 26, 2025
@ianbotsf
Copy link
Contributor

Hi @szymonsasin-nordic, thanks for your feature request. Are you currently experiencing specific issues with thread pools related to OkHttp and/or the AWS SDK?

@szymonsasin-nordic
Copy link
Author

Hi, not a major issue, but it would be great to be able to share thread pool. Same as it is with java aws sdk.

@ianbotsf
Copy link
Contributor

Understood, thanks. We likely won't prioritize this right away because we'll want to expose more options at the same time which will require some additional design considerations. I'll leave this open for tracking and for others to 👍.

If this becomes a critical need for you in the meantime, please note that HttpClientEngine is an open interface and you could wrap your own OkHttp instances if you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants