![]() |
|
A J2EE-based application server supports certain infrastructural services like Naming, Transactions, Security, etc. Components that are deployed on the server use these services for activities that are detached from the business logic. The Transactions service provides transactional support to application components that are deployed on the server. The Transaction service implemented on Pramati Server is based on the Java Transaction API (JTA) 1.0.1 specification.
A transaction can be defined as a unit of work containing multiple actions that take place to complete a business process. The J2EE transaction service allows multiple method calls that make up a single transaction unit.
For a container managed transaction, the container initiates and manages the transaction. The container marks the boundaries of a transaction. When you deploy a bean, you specify the transaction usage by declaring transaction attributes.
Note: You can use an asterisk ‘*’ for mentioning all the methods together.
Specify the required attribute as a value to the trans-attribute tag in the deployment descriptor file, ejb-jar.xml. The various transaction attributes are:
Table 1: Transaction attributes in ejb-jar.xml
| Attribute | A component with this attribute |
|---|---|
| Required | Needs to be a part of a transaction. If a transaction is currently running, the method becomes a part of this transaction. |
| RequiresNew | Initiates a new transaction. Any transaction that is currently running is suspended and resumed only after this method is executed. |
| NotSupported | Does not require a transaction. Any transaction that is currently running is suspended and is resumed only after this component is executed. |
| Supports | Supports the transactional behavior of the client. If the client is running within a transaction, the component executes in the transaction. However, if the client is not associated with a transaction, the component does not start a new transaction. Essentially, the component reflects the transactional behavior of the client. |
| Mandatory | Must be called from the client's transaction context. If not, the container will throw a javax.transaction.TransactionRequiredException. |
| Never | Must never be called from a client's transaction context. If not, the container will throw a java.rmi.RemoteException. |
Note: Make sure that this value takes into account your system environment and business logic, otherwise, the transactions may stop before completion.
To specify the duration after which a transaction rollback occurs:
All running transactions stop after this specified time and the transaction is rolled back.
To see transactions related statistics on the Console, select Monitor > Transactions in the Explore panel. This displays the following information:
Table 2: Transaction Statistics
| Fields | Options | Description |
|---|---|---|
| Total | - | Displays the total number of transactions that took place. |
| Concurrent | - | Displays the total number of transactions allowed. |
| - | Current | Refers to the current number of transactions allowed. |
| - | Min | Refers to the minimum number of transactions allowed. |
| - | Max | Refers to the maximum number of transactions allowed. |
| - | Avg | Refers to the average number of transactions allowed. |
| Committed | - | Displays the time taken for a transaction to commit. |
| - | Count | Refers to the number of transactions committed. |
| RolledBack | - | Displays the number of transactions that have to be RolledBack. |
| - | Count | Refers to the number of RolledBack transactions. |
| © Pramati Technologies 2007 | Runs on Pramati Server | Feedback | Legal |