Update @⁠ConcurrencyLimit documentation
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details

This commit updates the reference manual in order to reflect recent
changes made to @⁠ConcurrencyLimit.

See gh-35461
See gh-35470
See gh-35523
This commit is contained in:
Sam Brannen 2025-09-29 17:41:59 +02:00
parent b9e0a48e95
commit 2bd6422db9
1 changed files with 5 additions and 3 deletions

View File

@ -96,17 +96,16 @@ This is meant to protect the target resource from being accessed from too many t
the same time, similar to the effect of a pool size limit for a thread pool or a
connection pool that blocks access if its limit is reached.
You may optionally set the limit to 1, effectively locking access to the target bean
You may optionally set the limit to `1`, effectively locking access to the target bean
instance:
[source,java,indent=0,subs="verbatim,quotes"]
----
@ConcurrencyLimit(1) // <1>
@ConcurrencyLimit(1)
public void sendNotification() {
this.jmsClient.destination("notifications").send(...);
}
----
<1> 1 is the default, but specifying it makes the intent clearer.
Such limiting is particularly useful with Virtual Threads where there is generally no
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
which has been available since Spring Framework 1.0 for programmatic use with the AOP
framework.
TIP: `@ConcurrencyLimit` also has a `limitString` attribute that provides property
placeholder and SpEL support, as an alternative to the `int` based examples above.
[[resilience-annotations-configuration]]
== Enabling Resilient Methods