@@ -96,17 +96,16 @@ This is meant to protect the target resource from being accessed from too many t
96
96
the same time, similar to the effect of a pool size limit for a thread pool or a
97
97
connection pool that blocks access if its limit is reached.
98
98
99
- You may optionally set the limit to 1 , effectively locking access to the target bean
99
+ You may optionally set the limit to `1` , effectively locking access to the target bean
100
100
instance:
101
101
102
102
[source,java,indent=0,subs="verbatim,quotes"]
103
103
----
104
- @ConcurrencyLimit(1) // <1>
104
+ @ConcurrencyLimit(1)
105
105
public void sendNotification() {
106
106
this.jmsClient.destination("notifications").send(...);
107
107
}
108
108
----
109
- <1> 1 is the default, but specifying it makes the intent clearer.
110
109
111
110
Such limiting is particularly useful with Virtual Threads where there is generally no
112
111
thread pool limit in place. For asynchronous tasks, this can be constrained on
@@ -116,6 +115,9 @@ For synchronous invocations, this annotation provides equivalent behavior throug
116
115
which has been available since Spring Framework 1.0 for programmatic use with the AOP
117
116
framework.
118
117
118
+ TIP: `@ConcurrencyLimit` also has a `limitString` attribute that provides property
119
+ placeholder and SpEL support, as an alternative to the `int` based examples above.
120
+
119
121
120
122
[[resilience-annotations-configuration]]
121
123
== Enabling Resilient Methods
0 commit comments