EAServer provides the isRollbackOnly transaction primitive to determine if a transaction is doomed or still viable. If you have a component that does a lot of database updates, it is a good idea to call isRollbackOnly before issuing the updates since they would wind up being rolled back anyway in a doomed transaction.
To illustrate the benefits of using isRollbackOnly, we will use an example where ComponentA inserts a single row into a database, and then ComponentB inserts another 100 rows into the database. Lets look at two different scenarios for using these components.
Scenario 1 - isRollbackOnly is not used
ComponentA inserts 1 row, then calls rollbackWork() to indicate that the transaction should be doomed.
ComponentB inserts 100 rows then calls completeWork() to indicate success
After SessionBean completes, EAServer detects that the transaction is doomed. As a result, the inserts for all 101 rows will be rolled back.
Scenario 2 - isRollbackOnly is used to improve performance
ComponentA inserts 1 row, then calls rollbackWork() to indicate that the transaction should be doomed
ComponentB calls isRollbackOnly() to see if the transaction is still viable before doing any inserts.
After SessionBean completes, EAServer detects that the transaction is doomed. However, in this scenario, one a single insert will be rolled back.
For more information
For more information on the isRollbackOnly transaction primitive, see the EAServer Programmer Guid
[常用软件]在Maxthon中使用Google网站加速器 [常用软件]在POWERBUILDER中使用WINSOCK控件的方法 [VB.NET程序]在VB.NET中使用MS Access存储过程 — 第二部份 [VB.NET程序]在VB.NET中使用MS Access存储过程 — 第一部份 [VB.NET程序]在 VB 中使用 Unicode API [VB.NET程序]VB中使用WMI获取系统硬件和软件有关信息 [Delphi程序]DELPHI中使用API函数详解 [Delphi程序]在Delphi中使用Queued 组件 [Delphi程序]在delphi中使用flash控件 [Delphi程序]在delphi中使用xml文档有两种方法
|