fix: The shutdown of the application was blocked
authorKai Moritz <kai@juplo.de>
Wed, 6 Mar 2024 07:26:03 +0000 (08:26 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 22 Mar 2024 16:39:20 +0000 (17:39 +0100)
commit8db33e8ce2f4be4146d7b7989a8ef1e40448f9e7
treea0f4146770145691ff2e3f4064de6614e9f3ea01
parent0ce812fed1993a0de3026f481ecaac9ee8c4cffa
fix: The shutdown of the application was blocked

* The auto-configured bean `applicationTaskExecutor` must not block, while
  it is shutting down, because otherwise, it infinitly waits for the
  completion, of the channel-tasks, which are stopped in a _later_ phase
  of the "smart" lifecycle.
* The bean is destroyed first, becaus it is is associated with the lowest
  lifecyle-phase (``Integer.MAX_VALUE``), which apparently cannot be
  overruled by `@DependsOn` (although suggested by the spring-
  documentation)
* Joining the channel-tasks was blocking infinitly, because the tasks were
  waiting for the kafka-consumers to be closed, what only happens _after_
  the joining completes.
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesApplicationRunner.java
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesConfiguration.java
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesThreadPoolTaskExecutorCustomizer.java [new file with mode: 0644]