-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Revise an ExecutorService injections in favor of injected TaskExecutor #8642
Comments
Consider using a I tested virtual threads with spring-kafka with this... @Bean
ApplicationRunner runner(KafkaTemplate<String, String> template,
ConcurrentKafkaListenerContainerFactory<?, ?> factory) {
ThreadFactory tFactory = Thread.ofVirtual().factory();
factory.getContainerProperties().setListenerTaskExecutor(new SimpleAsyncTaskExecutor(tFactory));
return args -> {
template.send("loom1", "test");
template.send("loom1", "test");
template.send("loom1", "test");
template.send("loom1", "test");
Thread.sleep(5000);
};
} |
What I don't like with a single managed Probably the whole paradigm of managed executor doesn't bring any value when we switch to virtual threads. We can continue discussion though since I don't claim to be expert in this area: just sharing my pain over years with single managed executor. Out of context, but still might be an argument for |
I didn't mean a single shared TE, each component can get its own. In any case, as I've said before, unless something has changed, VTs don't get a |
Yeah... |
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`
Fixes spring-projects#8642 * Rework some `Executors.newSingleThreadExecutor()` to `ExecutorServiceAdapter(new SimpleAsyncTaskExecutor())` * Expose `TaskExecutor` setters; deprecate `ExecutorService`-based * Some other code clean up in the effected classes: `LogAccessor`, no `synchronized` in critical blocks * Give a meaningful prefix for default threads in the context of components, e.g. `SubscribableRedisChannel` - `getBeanName() + "-"`
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` * * Remove unused import from the `DebeziumMessageProducerSpec`
Fixes spring-projects#8642 * Rework some `Executors.newSingleThreadExecutor()` to `ExecutorServiceAdapter(new SimpleAsyncTaskExecutor())` * Expose `TaskExecutor` setters; deprecate `ExecutorService`-based * Some other code clean up in the effected classes: `LogAccessor`, no `synchronized` in critical blocks * Give a meaningful prefix for default threads in the context of components, e.g. `SubscribableRedisChannel` - `getBeanName() + "-"`
* GH-8642: Revise executors in the project Fixes #8642 * Rework some `Executors.newSingleThreadExecutor()` to `ExecutorServiceAdapter(new SimpleAsyncTaskExecutor())` * Expose `TaskExecutor` setters; deprecate `ExecutorService`-based * Some other code clean up in the effected classes: `LogAccessor`, no `synchronized` in critical blocks * Give a meaningful prefix for default threads in the context of components, e.g. `SubscribableRedisChannel` - `getBeanName() + "-"` * * Fix `PostgresChannelMessageTableSubscriberTests` for `PostgresSubscribableChannel` initialization to let it create its internal `Executor` * Use an `AsyncTaskExecutor` injection instead of `ExecutorServiceAdapter` wrapping * Fix `LockRegistryLeaderInitiatorTests` for `taskExecutor` injection * Bring back `LockRegistryLeaderInitiator.setExecutorService()` as an accident after property auto-renaming
Samples are
PostgresChannelMessageTableSubscriber
,org.springframework.integration.hazelcast.leader.LeaderInitiator
.These threads potentially can be created as virtual threads with Java 21.
The text was updated successfully, but these errors were encountered: