Monday, 2 September 2013

Concurrency control with method invocation in EJB bean vs. Spring bean

Concurrency control with method invocation in EJB bean vs. Spring bean

EJB container serializes all business method invocations by default. And
we have a couple of options to change it.
Apply the @Lock(LockType.READ)/@Lock(LockType.WRITE) annotations.
Or set @ConcurrencyManagement(ConcurrencyManagementType.BEAN) annotation
on the bean class and use our custom synchronization policy (use
syncrnozied blocks or don't use locks at all if bean only reads data, for
example). The @Lock annotations is ignored in this case.
My question is how does Spring control it? How does it work be default?
Spring bean may be a stateless bean or may have a state. It can access
some resource with read or write operations. And in different situations I
need an option to control concurrency.
Could you please explain and compare this aspect of EJB/Spring containers.

No comments:

Post a Comment