Commit 7f2315e
committed
GH-3005: Fix
Fixes: #3005
Issue link: #3005
The `SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.killOrRestart()`
is also called during application context shutdown.
At this moment we cannot emit events into an application context.
Otherwise, it fails with:
```
Exception in thread "rabbitListenerExecutor1" org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'refreshEventListener': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
```
* Introduce `ObservableListenerContainer.isApplicationContextClosed()`
and call it as additional condition in the `SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.killOrRestart()`
before trying to emit `AsyncConsumerStoppedEvent`
The fix for `3.1.x` requires a slightly different approach via `ContextClosedEvent`
# Conflicts:
# spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/ObservableListenerContainer.javaSimpleMLC.killOrRestart for closed AC1 parent 88c04bb commit 7f2315e
File tree
2 files changed
+14
-7
lines changed- spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener
2 files changed
+14
-7
lines changedLines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | | - | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
| |||
Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
798 | 799 | | |
799 | 800 | | |
800 | 801 | | |
801 | | - | |
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
| |||
863 | 863 | | |
864 | 864 | | |
865 | 865 | | |
866 | | - | |
867 | 866 | | |
868 | 867 | | |
869 | 868 | | |
| |||
1266 | 1265 | | |
1267 | 1266 | | |
1268 | 1267 | | |
1269 | | - | |
1270 | 1268 | | |
1271 | 1269 | | |
1272 | 1270 | | |
| |||
1531 | 1529 | | |
1532 | 1530 | | |
1533 | 1531 | | |
1534 | | - | |
1535 | | - | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
1536 | 1535 | | |
1537 | 1536 | | |
1538 | 1537 | | |
| |||
0 commit comments