|
| Problem | How do caching, select for update, and isolation level affect Enterprise JavaBeans™ (EJB™) consistency? | | | | Solution | In WebSphere® 3.5 two strategies are implemented:
Option A: In this strategy the WebSphere container caches the bean instance data the first time that the bean is referenced and serializes access when needed. There is only one instance of the bean within the container; however, this is within the scope of only one container. Therefore, if the bean is being accessed outside of that one container (for example, through WLM), there is a high potential for data corruption.
Option C: In this strategy the WebSphere container does not cache the bean instance. Multiple read-only instances might be created. Serialization is managed by the database. The container in no way controls serialization in Option C.
Option B: This option is not implemented in WebSphere Application Server version 3.5.
In either Option A or Option C serialization is gated by two things:
- How the bean is accessed
- What isolation level is used to access it
Here is how it works for DB2®:
Under the READ_COMMITTED and READ_UNCOMMITTED isolation levels, multiple SELECT of the bean data are allowed. When a SELECT FOR UPDATE is done, access to the bean data is serialized, but only until the result set from the select is processed, then the locks are dropped. Therefore, bean data is not protected; the potential for lost updates exists because multiple transactions can perform SELECT FOR UPDATE almost simultaneously, and the transactions can commit their updates to the database independent of each other.
Under the REPEATABLE_READ and TRANSACTION_SERIALIZABLE isolation levels, multiple SELECT of the bean data are allowed. However, when SELECT FOR UPDATE are performed, access to the bean data is serialized; therefore, lost updates are avoided. | |
| |
| |
|
Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, EJB Container Operating system(s): Multi-Platform Software version: 3.5 Software edition: Advanced Edition Reference #: 1046933 IBM Group: Software Group Modified date: 2004-12-01
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.
|