Using bean managed concurrency
While concurrency of a singleton is container managed by default, the developer can elect to manage the concurrency directly. The techniques used for this effort are illustrated in this recipe.
The steps used to incorporate bean managed concurrency involve:
- Specify the currency approach using the @ConcurrencyManagement annotation
- Designate critical methods with the Java
Critical methods are those methods which allow only a single thread at a time to use it.
How to do it...
We will reuse the
ConcurrencyExample application developed in the previous recipe to illustrate bean-managed concurrency. In the EJB module add a singleton EJB to the
packt package called
SimulationBeanManaged. Use the ...