Skip to content

Conversation

@bhabegger
Copy link

Some instantiations of ThreadPoolExecutor were setting a different corePoolSize and maxPoolSize even though they were using an unbounded LinkedBlockingQueue. The pattern was repeated multiple times. This PR attempts to fix and mutualize the ThreadPoolExecutor creation code.

@joerghoh
Copy link
Contributor

joerghoh commented Jan 9, 2026

@bhabegger good catch, thanks for the PR; can you create a dedicated OAK ticket for it?

@bhabegger bhabegger force-pushed the fix-executor-service branch from 4318b53 to e61cba0 Compare January 12, 2026 07:57
@bhabegger
Copy link
Author

@bhabegger good catch, thanks for the PR; can you create a dedicated OAK ticket for it?

Well, in fact it was hinted to me by @thomasmueller as a pending task that I took for my onboarding :) So, I don't have much credit for catching this;)

@bhabegger bhabegger force-pushed the fix-executor-service branch from e61cba0 to 33271ab Compare January 12, 2026 08:17
@bhabegger bhabegger changed the title Refactor creation of ThreadPoolExecutors OAK-12054: Refactor creation of ThreadPoolExecutors Jan 12, 2026
@bhabegger bhabegger force-pushed the fix-executor-service branch from 33271ab to eb16e23 Compare January 13, 2026 12:35
* ThreadFactory which names the threads based on a pattern. The pattern should contain a %d which is replaced by
* a unique number for each thread generated by this factory.
*/
public class NamedThreadFactory implements ThreadFactory {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use the BasicThreadFactory from commons-lang3 ?

Copy link
Author

Choose a reason for hiding this comment

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

We could indeed. However, the dependency to commons-lang3 is not yet in oak-commons module and this would pull it in transitively in other modules where in many of them have it marked as "provided". Being new to this project, I'm not clear on why that could be and if it would be a problem to add the dependency.

Copy link
Contributor

@rishabhdaim rishabhdaim Jan 15, 2026

Choose a reason for hiding this comment

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

we should add commons-lang3 as a dependency in oak-commons. @reschke wdyt ?

Copy link
Author

Choose a reason for hiding this comment

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

Added the dependency. @reschke Ok with you ?

Copy link
Member

Choose a reason for hiding this comment

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

I probably wouldn't add the dependency. (I wouldn't add indirection or a dependency if the benefit is tiny, as it is here.)

Copy link
Contributor

Choose a reason for hiding this comment

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

@thomasmueller commons-lang3 is already part of oak-commons but as a test dependency. So we are already using it.

@bhabegger bhabegger force-pushed the fix-executor-service branch from eb16e23 to 28c2927 Compare January 15, 2026 07:16
Copy link
Member

@thomasmueller thomasmueller left a comment

Choose a reason for hiding this comment

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

There is a risk if we change the current behavior, even if the current behavior is not what was intended originally: we could have out-of-memory, concurrency issues etc.

So either the PR should not change the current behavior, or at least, we should have a way to switch back to the old behavior, in case of issues. E.g. with a feature toggle.

Given that we don't currently see issue with the current behavior (other than it's not intended, and can confuse people, etc.), I think we should keep the current behavior.

@bhabegger bhabegger force-pushed the fix-executor-service branch 3 times, most recently from 687a16b to 443d867 Compare January 16, 2026 07:14
@bhabegger bhabegger requested a review from rishabhdaim January 16, 2026 07:17
Copy link
Member

@thomasmueller thomasmueller left a comment

Choose a reason for hiding this comment

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

Just some formatting.

@bhabegger bhabegger force-pushed the fix-executor-service branch from 5f19daa to 60ee9fa Compare January 16, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants