uCosminexus Application Server, EJB Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

2.19.1 Exclusive control of Singleton Session Beans

The two methods for exclusive control of a Singleton Session Bean are as follows:

When developing a Singleton Session Bean, you must determine the method you use to manage the exclusive control. You cannot use both the methods concurrently.

Organization of this subsection
(1) Container- Managed Concurrency
(2) Bean-Managed Concurrency

(1) Container- Managed Concurrency

The EJB container executes exclusive control. Respective business methods and timeout methods are controlled by the Read lock or Write lock. In the case of a method for which the Read lock is set, you can concurrently execute the processing of multiple methods. In the case of a method for which the Write lock is set, any other method is not invoked until the processing of one method is complete.

Specify the type of lock for a method of the Session Bean class or overridden class with an annotation. If you do not explicitly specify the type of lock, operation is performed in the same way as when the Write lock is specified.

When executing exclusive control, you can set the timeout period for pending processes. You can specify the timeout period using the @AccessTimeout annotation. If a timeout occurs, javax.ejb.ConcurrentAccessTimeoutException is thrown for the invocation source client by an EJB container.

(2) Bean-Managed Concurrency

If you specify the Bean-Managed Concurrency, exclusive control is not executed for a Singleton Session Bean by the EJB container. Implementation related to exclusive control is required during the application development. Implement using Synchronized and volatile in the Java language depending on the purpose of usage.