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

Executor instead of ThreadFactory for DebeziumMP #8646

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

artembilan
Copy link
Member

Related to #8642

For consistency with other Spring requirements and realignment with virtual threads, it is better to require a TaskExecutor injection instead of ThreadFactory

  • Fix DebeziumMessageProducer to rely on a TaskExecutor API instead of ThreadFactory and ExecutorService

Related to spring-projects#8642

For consistency with other Spring requirements and realignment with virtual threads,
it is better to require a `TaskExecutor` injection instead of `ThreadFactory`

* Fix `DebeziumMessageProducer` to rely on a `TaskExecutor` API instead of `ThreadFactory`
and `ExecutorService`
@@ -213,19 +202,6 @@ protected void doStop() {
}
}

@Override
public void destroy() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't you supposed to gracefully stop the task executor on exit?

Copy link
Member Author

Choose a reason for hiding this comment

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

See a destroy() impl in the super class. It does call that stop(); for us.

@tzolov
Copy link
Contributor

tzolov commented Jun 13, 2023

@artembilan,
iirc we picked the ThreadFactory initially, because we assumed that it will be easy to support virtual threads.
Is the TaskExecutor switch affecting this?

@artembilan
Copy link
Member Author

Is the TaskExecutor switch affecting this?

As far as I know that's the move Spring Framework (provides a VirtualThreadTaskExecutor) and Spring Boot (will auto-configure that VirtualThreadTaskExecutor) expect from us.
Plus asking for TaskExecutor injection is really what we do in many other places. Therefore for consistency I switch this to the same style as it is everywhere else in Spring.
See also what we have discussed with Gary in the issue related to this change: #8642

Well, the PartitionedChannel is an exception since that one really requires a dedicated thread for particular partition.
I won't mind, though, to migrate that one to a TaskExecutor as well, if there is the way to stick to the specific thread.

@tzolov
Copy link
Contributor

tzolov commented Jun 13, 2023

Ok, LGTM

@artembilan artembilan merged commit a862692 into spring-projects:main Jun 13, 2023
2 checks passed
@artembilan artembilan deleted the TasExecutor_for_Debezium branch June 13, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants