Issue Details (XML | Word | Printable)

Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: marina vatkina
Reporter: reza_rahman
Votes: 11
Watchers: 4

If you were logged in you would be able to see more operations.

Decoupling the @Lock/@AccessTimeout annotations from the EJB component model

Created: 17/Jun/11 06:13 PM   Updated: 06/Oct/13 06:05 PM
Component/s: None
Affects Version/s: 3.2
Fix Version/s: Future version

Time Tracking:
Not Specified

Participants: marina vatkina and reza_rahman

 Description  « Hide

Currently the EJB @Lock/@AccessTimeout annotations can only be used with @Singleton beans (@AccessTimeout can also be used with @Stateful). The @Lock/@AccessTimeout annotations are actually a very useful and elegant way of declaratively managing component concurrency. With the introduction of managed beans and CDI, there are not many good technical reasons why the @Lock/@AccessTimeout annotations should not be used in managed beans as well. Decoupling useful EJB services such as @Lock/@AccessTimeout from the component model moves towards removing one-off component models in Java EE in favor of unifying around managed beans/CDI.

We currently allow this capability in Resin. The code looks like this:

public class MyConcurrentBean {
public void myReadLockedTask() { ... }
public void myWriteLockedTask() { ... }

It should also be possible to use @Lock/@AccessTimeout in CDI stereotypes so that developers can compose custom component types to meet the needs of their individual applications. The code for this could look like the following:

public @interface ConcurrentComponent {}

reza_rahman added a comment - 06/Oct/13 06:05 PM

One logical place for decoupled @Lock/@AccessTimeout annotations could be the Java EE concurrency utilities.