-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MaxConcurrency annotation #136
Comments
If we have the new Async annotation I think we can have a very simple definition with just a single attribute for maxConcurrency and rely on Semaphore isolation. As the new Async annotation allows the developer to specify the specific ExecutorService which can be configured to have a maxAsync. Thread isolation can be acheived using the Async annotation and a ExecutorService with a configured maxAsync |
Any word on getting this in for EE 11? |
it's tagged as a candidate for 3.1 which is the Jakarta EE 11 release. I don't think any work has been done yet though. |
It seems like the most important part of this is already covered by Asynchronous/executor with maxAsync, and all that remains is semaphore isolation. I am wondering what the value is of providing a |
To remind of the original reason I proposed this, I don't think this should be coupled with @async, which is a totally separate use case (I think the same mistake/misunderstanding happened with @schedule). Even if it works functionally, the semantics are very confusing. The original intent was for a way to provide an equivalent to how EJB pooling effectively causes bandwidth throttling at the component level. This should be applicable to any CDI bean that can be concurrently accessed. This is an important missing piece for EJB users that see this type of functionality as valuable. Here are the two original code examples provided: |
I believe this could be highly beneficial for virtual threads. Since virtual threads can be created in virtually unlimited numbers, we often need a way to throttle them, such as using a semaphore. In this context, having an |
I also think it's important to have this feature, you can see this first sample RI for CDI context https://github.com/omnifaces/omniservices.... regards |
Big +1 for |
There are two reasons for aiming for a separate annotation. The primary one is treating this as a cross-cutting concurrency feature that can be applied to a variety of CDI components as users wish. Also, as far as I am aware, stereotypes themselves are not bound to interceptors directly and typically do not have attributes defined. I can see this, however, as an attribute of @Lock or something that works with @Lock. |
Understood. That also works for me. +1 for MaxConcurrency annotation |
Annotation to define max concurrency for access to a method or bean. This was first mooted on the EJB spec but adding to concurrency would mean this could be used generally across the platform.
See javaee/ejb-spec#9
Also see https://download.eclipse.org/microprofile/microprofile-fault-tolerance-2.1/apidocs/org/eclipse/microprofile/faulttolerance/Bulkhead.html
The text was updated successfully, but these errors were encountered: