Commit 275868e
authored
GH-3031: Defer SMLC shutdown for pending replies
Fixes: #3031
This commit introduces a mechanism to delay the shutdown of a
SimpleMessageListenerContainer if there are pending replies for
request/reply operations.
A new functional interface, `PendingReplyProvider`, is introduced and
can be set on the container. `RabbitTemplate` now exposes a
`getPendingReplyCount()` method to serve as this provider.
When the provider is set, the container will wait up to the configured
`shutdownTimeout` for the pending reply count to drop to zero before
proceeding with the consumer cancellation.
* Fix checkstyle violations
Refactor the shutdown deferral mechanism based on pull request feedback:
- Replace the custom `PendingReplyProvider` with the existing
`ListenerContainerAware` interface and `ActiveObjectCounter`.
- Move the waiting logic into the `awaitShutdown` runnable for
better consistency with the existing shutdown process.
* Refactor shutdown deferral logic based on review feedback
- Move @nullable to type declaration
- Use pattern matching for ListenerContainerAware
- Skip waiting when replyCounter is null or count is zero
- Extract shutdown wait logic into separate method
- Add author tag and update whats-new.adoc
* Refine test and update whats-new
This commit applies the final polishing suggestions from the review.
- The test case is refactored to be more robust and efficient. It now
verifies the warning log message via a spy instead of relying on
unstable timing assertions. The shutdown timeout is also reduced to
speed up the build.
- The `whats-new.adoc` document is updated with the title and
description suggested in the review.
* Refine shutdown deferral test for robustness
Improve test robustness by increasing the await timeout and remove
unnecessary cleanup code per review feedback.
Signed-off-by: Jeongjun Min <[email protected]>1 parent 5bcd01f commit 275868e
File tree
5 files changed
+98
-2
lines changed- spring-rabbit/src
- main/java/org/springframework/amqp/rabbit
- core
- listener
- support
- test/java/org/springframework/amqp/rabbit/listener
- src/reference/antora/modules/ROOT/pages
5 files changed
+98
-2
lines changedLines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| 194 | + | |
| 195 | + | |
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
| |||
2071 | 2075 | | |
2072 | 2076 | | |
2073 | 2077 | | |
| 2078 | + | |
2074 | 2079 | | |
2075 | 2080 | | |
2076 | 2081 | | |
| |||
2150 | 2155 | | |
2151 | 2156 | | |
2152 | 2157 | | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
2153 | 2161 | | |
2154 | 2162 | | |
2155 | 2163 | | |
2156 | 2164 | | |
2157 | | - | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
2158 | 2171 | | |
2159 | 2172 | | |
2160 | 2173 | | |
| |||
2666 | 2679 | | |
2667 | 2680 | | |
2668 | 2681 | | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
2669 | 2687 | | |
2670 | 2688 | | |
2671 | 2689 | | |
| |||
2696 | 2714 | | |
2697 | 2715 | | |
2698 | 2716 | | |
| 2717 | + | |
2699 | 2718 | | |
2700 | 2719 | | |
2701 | 2720 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
692 | 693 | | |
693 | 694 | | |
694 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
695 | 700 | | |
696 | 701 | | |
697 | 702 | | |
| |||
738 | 743 | | |
739 | 744 | | |
740 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
741 | 762 | | |
742 | 763 | | |
743 | 764 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
42 | 51 | | |
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
716 | 719 | | |
717 | 720 | | |
718 | 721 | | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
719 | 761 | | |
720 | 762 | | |
721 | 763 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments